def last(iterable):
    """ Return the last item from an iterable; raise IndexError on empty iterables.
  """
    nothing = True
    for item in iterable:
        nothing = False
    if nothing:
        raise IndexError('no items in iterable: %r' % (iterable,))
    return item
