code: def iter_islast(iterable):
      
      it = iter(iterable)
      prev = next(it)
      for item in it:
          yield prev, False
          prev = item
      yield prev, True
docs: Generate (item, islast) pairs for an iterable.
  
      Generates pairs where the first element is an item from the iterable
      source and the second element is a boolean flag indicating if it is
      the last item in the sequence.