Optimization of code is a good practice so we need to create a helper function for filtering of language data