code: def id_generator(start=0):
      
      count = start
      while True:
          send_value = (yield count)
          if not send_value is None:
              if send_value < count:
                  raise ValueError('Values from ID generator must increase '
                                   'monotonically (current value: %d; value '
                                   'sent to generator: %d).'
                                   % (count, send_value))
              count = send_value
          else:
              count += 1
docs: Generator for sequential numeric numbers.