def serialize(self):
return json.dumps({<EOL>"<STR_LIT:port>": self.port,<EOL>"<STR_LIT>": self.ip,<EOL>"<STR_LIT:host>": self.host,<EOL>"<STR_LIT>": self.peer.serialize() if self.peer else None,<EOL>"<STR_LIT>": json.dumps(self.metadata or {}, sort_keys=True),<EOL>}, sort_keys=True)<EOL>
Serializes the node data as a JSON map string.