code: def build_payload(self, payload):
          
          remaining_size = self.MAX_SEGMENT_PAYLOAD_SIZE
  
          for part in self.parts:
              part_payload = part.pack(remaining_size)
              payload.write(part_payload)
              remaining_size -= len(part_payload)
docs: Build payload of all parts and write them into the payload buffer