<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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}')