<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_by_size(feat_dir: Path, prefixes: List[str], feat_type: str, max_samples: int) -> List[str]: """ Sorts the files by their length and returns those with less than or equal to max_samples length. Returns the filename prefixes of those files. The main job of the method is to filter, but the sorting may give better efficiency when doing dynamic batching unless it gets shuffled downstream. """


    # TODO Tell the user what utterances we are removing.
    prefix_lens = get_prefix_lens(Path(feat_dir), prefixes, feat_type)
    prefixes = [prefix for prefix, length in prefix_lens
                if length <= max_samples]
    return prefixes