For crypto part use https://cryptography.io/en/latest/hazmat/primitives/asymmetric/rsa/
Here is how this function could look:
envelope = create_envelope(nodes, content)
nodes should be list of tuples tuple has two elements: node's IP address and public key.
content should be any JSON serializable object.
Returned envelope can be deserialized with primary keys of nodes in reverse order.