def single(sequence, condition=None):
    """
    Returns the single item in a sequence that satisfies specified condition or
    raises error if none or more items found.
    
    Args:
        sequence: iterable
            Sequence of items to go through.
        
        condition: callable
            Condition to test.
    
    Returns:
        any
            Single valid item.
    """
    
    items = list(sequence) if condition is None else [d for d in sequence if condition(d)]
    if len(items) == 1:
        return items[0]
    
    raise ValueError