def filter_data(src, trg, min_len=0, max_len=float("inf")):
    """Filters data on source and target lengths

    Args:
        src (list[int]): Tokenized source data
        trg (list[int]): Tokenized target data
        min_len (int): Minimum length
        max_len (int): Maximum length

    Returns:
        (list[int], list[int]): The filtered data (tokenized)
    """
    filtered_src = []
    filtered_trg = []
    for src, trg in zip(src, trg):
        if min_len <= len(src) <= max_len and min_len <= len(trg) <= max_len:
            filtered_src.append(src)
            filtered_trg.append(trg)
    return filtered_src, filtered_trg