def filter_list(func, alist):
    """ Filters a list using a function.

    :param func: A function used for filtering.
    :param alist: The list to filter.

    :returns: The filtered list.

    >>> from dautils import collect
    >>> alist = ['a', 'a.color', 'color.b']
    >>> collect.filter_list(lambda x: x.endswith('color'), alist)
    ['a.color']
    """
    return [a for a in alist if func(a)]