The first item in that sequence

    If there aren't any, raise a ValueError with that message

def first(sequence, message=None):
    """The first item in that sequence

    If there aren't any, raise a ValueError with that message
    """
    try:
        return next(iter(sequence))
    except StopIteration:
        raise ValueError(message or ('Sequence is empty: %s' % sequence))