def first(collection, callback):
    """
    Find the first item in collection that, when passed to callback, returns
    True. Returns None if no such item is found.
    """
    return next((item for item in collection if callback(item)), None)