code: def islast(generator):
      ''' indicate whether the current item is the last one in a generator
      '''
      next_x = None
      first = True
      for x in generator:
          if not first:
              yield (next_x, False)
          next_x = x
          first = False
      if not first:
          yield (next_x, Truef islast(generator):
      ''' indicate whether the current item is the last one in a generator
      '''
      next_x = None
      first = True
      for x in generator:
          if not first:
              yield (next_x, False)
          next_x = x
          first = False
      if not first:
          yield (next_x, True)
docs: indicate whether the current item is the last one in a generator