def filter(f,data):
    """
    Returns a copy of data, removing anything for which f
    is false

    Parameter f: The function to apply
    Precondition: f is a BOOLEAN function taking exactly one argument

    Parameter data: The data to process
    Precondition: data an iterable, each element satisfying precond of f
    """
    accum = []
    for item in data:
        if f(item):
            accum.append(item)
    return accum