def handle_create_payload(<EOL>entity: BaseEntity,<EOL>author_user: UserType,<EOL>protocol_name: str,<EOL>to_user_key: RsaKey = None,<EOL>parent_user: UserType = None,<EOL>) -> str:
mappers = importlib.import_module(f"<STR_LIT>")<EOL>protocol = importlib.import_module(f"<STR_LIT>")<EOL>protocol = protocol.Protocol()<EOL>outbound_entity = mappers.get_outbound_entity(entity, author_user.private_key)<EOL>if parent_user:<EOL><INDENT>outbound_entity.sign_with_parent(parent_user.private_key)<EOL><DEDENT>send_as_user = parent_user if parent_user else author_user<EOL>data = protocol.build_send(entity=outbound_entity, from_user=send_as_user, to_user_key=to_user_key)<EOL>return data<EOL>
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)