def get_outbound_entity(entity: BaseEntity, private_key: RsaKey):
if getattr(entity, "<STR_LIT>", None):<EOL><INDENT>return entity<EOL><DEDENT>outbound = None<EOL>cls = entity.__class__<EOL>if cls in [DiasporaPost, DiasporaImage, DiasporaComment, DiasporaLike, DiasporaProfile, DiasporaRetraction,<EOL>DiasporaContact, DiasporaReshare]:<EOL><INDENT>outbound = entity<EOL><DEDENT>elif cls == Post:<EOL><INDENT>outbound = DiasporaPost.from_base(entity)<EOL><DEDENT>elif cls == Comment:<EOL><INDENT>outbound = DiasporaComment.from_base(entity)<EOL><DEDENT>elif cls == Reaction:<EOL><INDENT>if entity.reaction == "<STR_LIT>":<EOL><INDENT>outbound = DiasporaLike.from_base(entity)<EOL><DEDENT><DEDENT>elif cls == Follow:<EOL><INDENT>outbound = DiasporaContact.from_base(entity)<EOL><DEDENT>elif cls == Profile:<EOL><INDENT>outbound = DiasporaProfile.from_base(entity)<EOL><DEDENT>elif cls == Retraction:<EOL><INDENT>outbound = DiasporaRetraction.from_base(entity)<EOL><DEDENT>elif cls == Share:<EOL><INDENT>outbound = DiasporaReshare.from_base(entity)<EOL><DEDENT>if not outbound:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if isinstance(outbound, DiasporaRelayableMixin) and not outbound.signature:<EOL><INDENT>outbound.sign(private_key)<EOL>outbound.parent_signature = outbound.signature<EOL><DEDENT>return outbound<EOL>
Get the correct outbound entity for this protocol.

    We might have to look at entity values to decide the correct outbound entity.
    If we cannot find one, we should raise as conversion cannot be guaranteed to the given protocol.

    Private key of author is needed to be passed for signing the outbound entity.

    :arg entity: An entity instance which can be of a base or protocol entity class.
    :arg private_key: Private key of sender as an RSA object
    :returns: Protocol specific entity class instance.
    :raises ValueError: If conversion cannot be done.