code: def handle_create_payload(
          entity: BaseEntity,
          author_user: UserType,
          protocol_name: str,
          to_user_key: RsaKey = None,
          parent_user: UserType = None,
  ) -> str:
      
      mappers = importlib.import_module(f"federation.entities.{protocol_name}.mappers")
      protocol = importlib.import_module(f"federation.protocols.{protocol_name}.protocol")
      protocol = protocol.Protocol()
      outbound_entity = mappers.get_outbound_entity(entity, author_user.private_key)
      if parent_user:
          outbound_entity.sign_with_parent(parent_user.private_key)
      send_as_user = parent_user if parent_user else author_user
      data = protocol.build_send(entity=outbound_entity, from_user=send_as_user, to_user_key=to_user_key)
      return data
docs: Create a payload with the given protocol.
  
      Any given user arguments must have ``private_key`` and ``handle`` attributes.
  
      :arg entity: Entity object to send. Can be a base entity or a protocol specific one.
      :arg author_user: User authoring the object.
      :arg protocol_name: Protocol to create payload for.
      :arg to_user_key: Public key of user private payload is being sent to, required for private payloads.
      :arg parent_user: (Optional) User object of the parent object, if there is one. This must be given for the
                        Diaspora protocol if a parent object exists, so that a proper ``parent_author_signature`` can
                        be generated. If given, the payload will be sent as this user.
      :returns: Built payload message (str)