def first(sequence, condition=None):
    """
    Returns the first item in a sequence that satisfies specified condition or
    raises error if no item found.
    
    Args:
        sequence: iterable
            Sequence of items to go through.
        
        condition: callable
            Condition to test.
    
    Returns:
        any
            First valid item.
    """
    
    if condition is None:
        return next((d for d in sequence))
    
    return next((d for d in sequence if condition(d)))