Returns the elements of B that are not in A.

def difference (b, a):
    """ Returns the elements of B that are not in A.
    """
    a = set(a)
    result = []
    for item in b:
        if item not in a:
            result.append(item)
    return result