def last(iterable):
    """
    Return the last item from the iterable, discarding the rest.

    >>> last(range(20))
    19
    >>> last([])
    Traceback (most recent call last):
    ...
    ValueError: Iterable contains no items
    """
    for item in iterable:
        pass
    try:
        return item
    except NameError:
        raise ValueError('Iterable contains no items')
