def filter_by_contains(fragment):
    """
    A higher-order function that returns a function that checks whether
    a filename contains fragment.
    :param fragment:
    :return:
    """
    def filt(filename):
        return fragment in filename
    return filt