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

    If there aren't any, raise a ValueError with that message
    """
    try:
        return sequence.pop()
    except AttributeError:
        return list(sequence).pop()
    except IndexError:
        raise ValueError(message or f'Sequence is empty: {sequence}')
The last item in that sequence

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