code: def create_offsets(zk, consumer_group, offsets):
      
      # Create new offsets
      for topic, partition_offsets in six.iteritems(offsets):
          for partition, offset in six.iteritems(partition_offsets):
              new_path = "/consumers/{groupid}/offsets/{topic}/{partition}".format(
                  groupid=consumer_group,
                  topic=topic,
                  partition=partition,
              )
              try:
                  zk.create(new_path, value=offset, makepath=True)
              except NodeExistsError:
                  print(
                      "Error: Path {path} already exists. Please re-run the "
                      "command.".format(path=new_path),
                      file=sys.stderr,
                  )
                  raise
docs: Create path with offset value for each topic-partition of given consumer
      group.
  
      :param zk: Zookeeper client
      :param consumer_group: Consumer group id for given offsets
      :type consumer_group: int
      :param offsets: Offsets of all topic-partitions
      :type offsets: dict(topic, dict(partition, offset))