def filter_by_extension(ext):
    """
    A higher-order function that returns a function
    that given a filename filters by the extension
    argument.
    :param ext: the return function will return true if a filename ends with ext
    :return: a one-arg function that takes a filename and returns true if filename ends with ext
    """
    def filt(filename):
        return filename.endswith(ext)
    return filt