We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Message asked for local pretraining is missing the "content" para when train a graph model in distributed mode?

If no "content" para, there will raise ValueError('The data type {} has not been supported.'.format(type(value))) in Message.create_by_type() function.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `federatedscope/core/message.py`
Content:
```
1 import json
2 import numpy as np
3 from federatedscope.core.proto import gRPC_comm_manager_pb2
4 
5 
6 class Message(object):
7     """
8     The data exchanged during an FL course are abstracted as 'Message' in
9     FederatedScope.
10     A message object includes:
11         msg_type: The type of message, which is used to trigger the
12         corresponding handlers of server/client
13         sender: The sender's ID
14         receiver: The receiver's ID
15         state: The training round of the message, which is determined by
16         the sender and used to filter out the outdated messages.
17         strategy: redundant attribute
18     """
19     def __init__(self,
20                  msg_type=None,
21                  sender=0,
22                  receiver=0,
23                  state=0,
24                  content=None,
25                  timestamp=0,
26                  strategy=None):
27         self._msg_type = msg_type
28         self._sender = sender
29         self._receiver = receiver
30         self._state = state
31         self._content = content
32         self._timestamp = timestamp
33         self._strategy = strategy
34 
35     @property
36     def msg_type(self):
37         return self._msg_type
38 
39     @msg_type.setter
40     def msg_type(self, value):
41         self._msg_type = value
42 
43     @property
44     def sender(self):
45         return self._sender
46 
47     @sender.setter
48     def sender(self, value):
49         self._sender = value
50 
51     @property
52     def receiver(self):
53         return self._receiver
54 
55     @receiver.setter
56     def receiver(self, value):
57         self._receiver = value
58 
59     @property
60     def state(self):
61         return self._state
62 
63     @state.setter
64     def state(self, value):
65         self._state = value
66 
67     @property
68     def content(self):
69         return self._content
70 
71     @content.setter
72     def content(self, value):
73         self._content = value
74 
75     @property
76     def timestamp(self):
77         return self._timestamp
78 
79     @timestamp.setter
80     def timestamp(self, value):
81         assert isinstance(value, int) or isinstance(value, float), \
82             "We only support an int or a float value for timestamp"
83         self._timestamp = value
84 
85     @property
86     def strategy(self):
87         return self._strategy
88 
89     @strategy.setter
90     def strategy(self, value):
91         self._strategy = value
92 
93     def __lt__(self, other):
94         if self.timestamp != other.timestamp:
95             return self.timestamp < other.timestamp
96         else:
97             return self.state < other.state
98 
99     def transform_to_list(self, x):
100         if isinstance(x, list) or isinstance(x, tuple):
101             return [self.transform_to_list(each_x) for each_x in x]
102         elif isinstance(x, dict):
103             for key in x.keys():
104                 x[key] = self.transform_to_list(x[key])
105             return x
106         else:
107             if hasattr(x, 'tolist'):
108                 return x.tolist()
109             else:
110                 return x
111 
112     def msg_to_json(self, to_list=False):
113         if to_list:
114             self.content = self.transform_to_list(self.content)
115 
116         json_msg = {
117             'msg_type': self.msg_type,
118             'sender': self.sender,
119             'receiver': self.receiver,
120             'state': self.state,
121             'content': self.content,
122             'timestamp': self.timestamp,
123             'strategy': self.strategy,
124         }
125         return json.dumps(json_msg)
126 
127     def json_to_msg(self, json_string):
128         json_msg = json.loads(json_string)
129         self.msg_type = json_msg['msg_type']
130         self.sender = json_msg['sender']
131         self.receiver = json_msg['receiver']
132         self.state = json_msg['state']
133         self.content = json_msg['content']
134         self.timestamp = json_msg['timestamp']
135         self.strategy = json_msg['strategy']
136 
137     def create_by_type(self, value, nested=False):
138         if isinstance(value, dict):
139             if isinstance(list(value.keys())[0], str):
140                 m_dict = gRPC_comm_manager_pb2.mDict_keyIsString()
141                 key_type = 'string'
142             else:
143                 m_dict = gRPC_comm_manager_pb2.mDict_keyIsInt()
144                 key_type = 'int'
145 
146             for key in value.keys():
147                 m_dict.dict_value[key].MergeFrom(
148                     self.create_by_type(value[key], nested=True))
149             if nested:
150                 msg_value = gRPC_comm_manager_pb2.MsgValue()
151                 if key_type == 'string':
152                     msg_value.dict_msg_stringkey.MergeFrom(m_dict)
153                 else:
154                     msg_value.dict_msg_intkey.MergeFrom(m_dict)
155                 return msg_value
156             else:
157                 return m_dict
158         elif isinstance(value, list) or isinstance(value, tuple):
159             m_list = gRPC_comm_manager_pb2.mList()
160             for each in value:
161                 m_list.list_value.append(self.create_by_type(each,
162                                                              nested=True))
163             if nested:
164                 msg_value = gRPC_comm_manager_pb2.MsgValue()
165                 msg_value.list_msg.MergeFrom(m_list)
166                 return msg_value
167             else:
168                 return m_list
169         else:
170             m_single = gRPC_comm_manager_pb2.mSingle()
171             if type(value) in [int, np.int32]:
172                 m_single.int_value = value
173             elif type(value) in [str]:
174                 m_single.str_value = value
175             elif type(value) in [float, np.float32]:
176                 m_single.float_value = value
177             else:
178                 raise ValueError(
179                     'The data type {} has not been supported.'.format(
180                         type(value)))
181 
182             if nested:
183                 msg_value = gRPC_comm_manager_pb2.MsgValue()
184                 msg_value.single_msg.MergeFrom(m_single)
185                 return msg_value
186             else:
187                 return m_single
188 
189     def build_msg_value(self, value):
190         msg_value = gRPC_comm_manager_pb2.MsgValue()
191 
192         if isinstance(value, list) or isinstance(value, tuple):
193             msg_value.list_msg.MergeFrom(self.create_by_type(value))
194         elif isinstance(value, dict):
195             if isinstance(list(value.keys())[0], str):
196                 msg_value.dict_msg_stringkey.MergeFrom(
197                     self.create_by_type(value))
198             else:
199                 msg_value.dict_msg_intkey.MergeFrom(self.create_by_type(value))
200         else:
201             msg_value.single_msg.MergeFrom(self.create_by_type(value))
202 
203         return msg_value
204 
205     def transform(self, to_list=False):
206         if to_list:
207             self.content = self.transform_to_list(self.content)
208 
209         splited_msg = gRPC_comm_manager_pb2.MessageRequest()  # map/dict
210         splited_msg.msg['sender'].MergeFrom(self.build_msg_value(self.sender))
211         splited_msg.msg['receiver'].MergeFrom(
212             self.build_msg_value(self.receiver))
213         splited_msg.msg['state'].MergeFrom(self.build_msg_value(self.state))
214         splited_msg.msg['msg_type'].MergeFrom(
215             self.build_msg_value(self.msg_type))
216         splited_msg.msg['content'].MergeFrom(self.build_msg_value(
217             self.content))
218         splited_msg.msg['timestamp'].MergeFrom(
219             self.build_msg_value(self.timestamp))
220         return splited_msg
221 
222     def _parse_msg(self, value):
223         if isinstance(value, gRPC_comm_manager_pb2.MsgValue) or isinstance(
224                 value, gRPC_comm_manager_pb2.mSingle):
225             return self._parse_msg(getattr(value, value.WhichOneof("type")))
226         elif isinstance(value, gRPC_comm_manager_pb2.mList):
227             return [self._parse_msg(each) for each in value.list_value]
228         elif isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsString) or \
229                 isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsInt):
230             return {
231                 k: self._parse_msg(value.dict_value[k])
232                 for k in value.dict_value
233             }
234         else:
235             return value
236 
237     def parse(self, received_msg):
238         self.sender = self._parse_msg(received_msg['sender'])
239         self.receiver = self._parse_msg(received_msg['receiver'])
240         self.msg_type = self._parse_msg(received_msg['msg_type'])
241         self.state = self._parse_msg(received_msg['state'])
242         self.content = self._parse_msg(received_msg['content'])
243         self.timestamp = self._parse_msg(received_msg['timestamp'])
244 
245     def count_bytes(self):
246         """
247             calculate the message bytes to be sent/received
248         :return: tuple of bytes of the message to be sent and received
249         """
250         from pympler import asizeof
251         download_bytes = asizeof.asizeof(self.content)
252         upload_cnt = len(self.receiver) if isinstance(self.receiver,
253                                                       list) else 1
254         upload_bytes = download_bytes * upload_cnt
255         return download_bytes, upload_bytes
256
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/federatedscope/core/message.py b/federatedscope/core/message.py
--- a/federatedscope/core/message.py
+++ b/federatedscope/core/message.py
@@ -21,7 +21,7 @@
                  sender=0,
                  receiver=0,
                  state=0,
-                 content=None,
+                 content='None',
                  timestamp=0,
                  strategy=None):
         self._msg_type = msg_type

{"golden_diff": "diff --git a/federatedscope/core/message.py b/federatedscope/core/message.py\n--- a/federatedscope/core/message.py\n+++ b/federatedscope/core/message.py\n@@ -21,7 +21,7 @@\n                  sender=0,\n                  receiver=0,\n                  state=0,\n-                 content=None,\n+                 content='None',\n                  timestamp=0,\n                  strategy=None):\n         self._msg_type = msg_type\n", "issue": "Message asked for local pretraining is missing the \"content\" para when train a graph model in distributed mode?\n\r\nIf no \"content\" para, there will raise ValueError('The data type {} has not been supported.'.format(type(value))) in Message.create_by_type() function.\n", "before_files": [{"content": "import json\nimport numpy as np\nfrom federatedscope.core.proto import gRPC_comm_manager_pb2\n\n\nclass Message(object):\n    \"\"\"\n    The data exchanged during an FL course are abstracted as 'Message' in\n    FederatedScope.\n    A message object includes:\n        msg_type: The type of message, which is used to trigger the\n        corresponding handlers of server/client\n        sender: The sender's ID\n        receiver: The receiver's ID\n        state: The training round of the message, which is determined by\n        the sender and used to filter out the outdated messages.\n        strategy: redundant attribute\n    \"\"\"\n    def __init__(self,\n                 msg_type=None,\n                 sender=0,\n                 receiver=0,\n                 state=0,\n                 content=None,\n                 timestamp=0,\n                 strategy=None):\n        self._msg_type = msg_type\n        self._sender = sender\n        self._receiver = receiver\n        self._state = state\n        self._content = content\n        self._timestamp = timestamp\n        self._strategy = strategy\n\n    @property\n    def msg_type(self):\n        return self._msg_type\n\n    @msg_type.setter\n    def msg_type(self, value):\n        self._msg_type = value\n\n    @property\n    def sender(self):\n        return self._sender\n\n    @sender.setter\n    def sender(self, value):\n        self._sender = value\n\n    @property\n    def receiver(self):\n        return self._receiver\n\n    @receiver.setter\n    def receiver(self, value):\n        self._receiver = value\n\n    @property\n    def state(self):\n        return self._state\n\n    @state.setter\n    def state(self, value):\n        self._state = value\n\n    @property\n    def content(self):\n        return self._content\n\n    @content.setter\n    def content(self, value):\n        self._content = value\n\n    @property\n    def timestamp(self):\n        return self._timestamp\n\n    @timestamp.setter\n    def timestamp(self, value):\n        assert isinstance(value, int) or isinstance(value, float), \\\n            \"We only support an int or a float value for timestamp\"\n        self._timestamp = value\n\n    @property\n    def strategy(self):\n        return self._strategy\n\n    @strategy.setter\n    def strategy(self, value):\n        self._strategy = value\n\n    def __lt__(self, other):\n        if self.timestamp != other.timestamp:\n            return self.timestamp < other.timestamp\n        else:\n            return self.state < other.state\n\n    def transform_to_list(self, x):\n        if isinstance(x, list) or isinstance(x, tuple):\n            return [self.transform_to_list(each_x) for each_x in x]\n        elif isinstance(x, dict):\n            for key in x.keys():\n                x[key] = self.transform_to_list(x[key])\n            return x\n        else:\n            if hasattr(x, 'tolist'):\n                return x.tolist()\n            else:\n                return x\n\n    def msg_to_json(self, to_list=False):\n        if to_list:\n            self.content = self.transform_to_list(self.content)\n\n        json_msg = {\n            'msg_type': self.msg_type,\n            'sender': self.sender,\n            'receiver': self.receiver,\n            'state': self.state,\n            'content': self.content,\n            'timestamp': self.timestamp,\n            'strategy': self.strategy,\n        }\n        return json.dumps(json_msg)\n\n    def json_to_msg(self, json_string):\n        json_msg = json.loads(json_string)\n        self.msg_type = json_msg['msg_type']\n        self.sender = json_msg['sender']\n        self.receiver = json_msg['receiver']\n        self.state = json_msg['state']\n        self.content = json_msg['content']\n        self.timestamp = json_msg['timestamp']\n        self.strategy = json_msg['strategy']\n\n    def create_by_type(self, value, nested=False):\n        if isinstance(value, dict):\n            if isinstance(list(value.keys())[0], str):\n                m_dict = gRPC_comm_manager_pb2.mDict_keyIsString()\n                key_type = 'string'\n            else:\n                m_dict = gRPC_comm_manager_pb2.mDict_keyIsInt()\n                key_type = 'int'\n\n            for key in value.keys():\n                m_dict.dict_value[key].MergeFrom(\n                    self.create_by_type(value[key], nested=True))\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                if key_type == 'string':\n                    msg_value.dict_msg_stringkey.MergeFrom(m_dict)\n                else:\n                    msg_value.dict_msg_intkey.MergeFrom(m_dict)\n                return msg_value\n            else:\n                return m_dict\n        elif isinstance(value, list) or isinstance(value, tuple):\n            m_list = gRPC_comm_manager_pb2.mList()\n            for each in value:\n                m_list.list_value.append(self.create_by_type(each,\n                                                             nested=True))\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                msg_value.list_msg.MergeFrom(m_list)\n                return msg_value\n            else:\n                return m_list\n        else:\n            m_single = gRPC_comm_manager_pb2.mSingle()\n            if type(value) in [int, np.int32]:\n                m_single.int_value = value\n            elif type(value) in [str]:\n                m_single.str_value = value\n            elif type(value) in [float, np.float32]:\n                m_single.float_value = value\n            else:\n                raise ValueError(\n                    'The data type {} has not been supported.'.format(\n                        type(value)))\n\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                msg_value.single_msg.MergeFrom(m_single)\n                return msg_value\n            else:\n                return m_single\n\n    def build_msg_value(self, value):\n        msg_value = gRPC_comm_manager_pb2.MsgValue()\n\n        if isinstance(value, list) or isinstance(value, tuple):\n            msg_value.list_msg.MergeFrom(self.create_by_type(value))\n        elif isinstance(value, dict):\n            if isinstance(list(value.keys())[0], str):\n                msg_value.dict_msg_stringkey.MergeFrom(\n                    self.create_by_type(value))\n            else:\n                msg_value.dict_msg_intkey.MergeFrom(self.create_by_type(value))\n        else:\n            msg_value.single_msg.MergeFrom(self.create_by_type(value))\n\n        return msg_value\n\n    def transform(self, to_list=False):\n        if to_list:\n            self.content = self.transform_to_list(self.content)\n\n        splited_msg = gRPC_comm_manager_pb2.MessageRequest()  # map/dict\n        splited_msg.msg['sender'].MergeFrom(self.build_msg_value(self.sender))\n        splited_msg.msg['receiver'].MergeFrom(\n            self.build_msg_value(self.receiver))\n        splited_msg.msg['state'].MergeFrom(self.build_msg_value(self.state))\n        splited_msg.msg['msg_type'].MergeFrom(\n            self.build_msg_value(self.msg_type))\n        splited_msg.msg['content'].MergeFrom(self.build_msg_value(\n            self.content))\n        splited_msg.msg['timestamp'].MergeFrom(\n            self.build_msg_value(self.timestamp))\n        return splited_msg\n\n    def _parse_msg(self, value):\n        if isinstance(value, gRPC_comm_manager_pb2.MsgValue) or isinstance(\n                value, gRPC_comm_manager_pb2.mSingle):\n            return self._parse_msg(getattr(value, value.WhichOneof(\"type\")))\n        elif isinstance(value, gRPC_comm_manager_pb2.mList):\n            return [self._parse_msg(each) for each in value.list_value]\n        elif isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsString) or \\\n                isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsInt):\n            return {\n                k: self._parse_msg(value.dict_value[k])\n                for k in value.dict_value\n            }\n        else:\n            return value\n\n    def parse(self, received_msg):\n        self.sender = self._parse_msg(received_msg['sender'])\n        self.receiver = self._parse_msg(received_msg['receiver'])\n        self.msg_type = self._parse_msg(received_msg['msg_type'])\n        self.state = self._parse_msg(received_msg['state'])\n        self.content = self._parse_msg(received_msg['content'])\n        self.timestamp = self._parse_msg(received_msg['timestamp'])\n\n    def count_bytes(self):\n        \"\"\"\n            calculate the message bytes to be sent/received\n        :return: tuple of bytes of the message to be sent and received\n        \"\"\"\n        from pympler import asizeof\n        download_bytes = asizeof.asizeof(self.content)\n        upload_cnt = len(self.receiver) if isinstance(self.receiver,\n                                                      list) else 1\n        upload_bytes = download_bytes * upload_cnt\n        return download_bytes, upload_bytes\n", "path": "federatedscope/core/message.py"}], "after_files": [{"content": "import json\nimport numpy as np\nfrom federatedscope.core.proto import gRPC_comm_manager_pb2\n\n\nclass Message(object):\n    \"\"\"\n    The data exchanged during an FL course are abstracted as 'Message' in\n    FederatedScope.\n    A message object includes:\n        msg_type: The type of message, which is used to trigger the\n        corresponding handlers of server/client\n        sender: The sender's ID\n        receiver: The receiver's ID\n        state: The training round of the message, which is determined by\n        the sender and used to filter out the outdated messages.\n        strategy: redundant attribute\n    \"\"\"\n    def __init__(self,\n                 msg_type=None,\n                 sender=0,\n                 receiver=0,\n                 state=0,\n                 content='None',\n                 timestamp=0,\n                 strategy=None):\n        self._msg_type = msg_type\n        self._sender = sender\n        self._receiver = receiver\n        self._state = state\n        self._content = content\n        self._timestamp = timestamp\n        self._strategy = strategy\n\n    @property\n    def msg_type(self):\n        return self._msg_type\n\n    @msg_type.setter\n    def msg_type(self, value):\n        self._msg_type = value\n\n    @property\n    def sender(self):\n        return self._sender\n\n    @sender.setter\n    def sender(self, value):\n        self._sender = value\n\n    @property\n    def receiver(self):\n        return self._receiver\n\n    @receiver.setter\n    def receiver(self, value):\n        self._receiver = value\n\n    @property\n    def state(self):\n        return self._state\n\n    @state.setter\n    def state(self, value):\n        self._state = value\n\n    @property\n    def content(self):\n        return self._content\n\n    @content.setter\n    def content(self, value):\n        self._content = value\n\n    @property\n    def timestamp(self):\n        return self._timestamp\n\n    @timestamp.setter\n    def timestamp(self, value):\n        assert isinstance(value, int) or isinstance(value, float), \\\n            \"We only support an int or a float value for timestamp\"\n        self._timestamp = value\n\n    @property\n    def strategy(self):\n        return self._strategy\n\n    @strategy.setter\n    def strategy(self, value):\n        self._strategy = value\n\n    def __lt__(self, other):\n        if self.timestamp != other.timestamp:\n            return self.timestamp < other.timestamp\n        else:\n            return self.state < other.state\n\n    def transform_to_list(self, x):\n        if isinstance(x, list) or isinstance(x, tuple):\n            return [self.transform_to_list(each_x) for each_x in x]\n        elif isinstance(x, dict):\n            for key in x.keys():\n                x[key] = self.transform_to_list(x[key])\n            return x\n        else:\n            if hasattr(x, 'tolist'):\n                return x.tolist()\n            else:\n                return x\n\n    def msg_to_json(self, to_list=False):\n        if to_list:\n            self.content = self.transform_to_list(self.content)\n\n        json_msg = {\n            'msg_type': self.msg_type,\n            'sender': self.sender,\n            'receiver': self.receiver,\n            'state': self.state,\n            'content': self.content,\n            'timestamp': self.timestamp,\n            'strategy': self.strategy,\n        }\n        return json.dumps(json_msg)\n\n    def json_to_msg(self, json_string):\n        json_msg = json.loads(json_string)\n        self.msg_type = json_msg['msg_type']\n        self.sender = json_msg['sender']\n        self.receiver = json_msg['receiver']\n        self.state = json_msg['state']\n        self.content = json_msg['content']\n        self.timestamp = json_msg['timestamp']\n        self.strategy = json_msg['strategy']\n\n    def create_by_type(self, value, nested=False):\n        if isinstance(value, dict):\n            if isinstance(list(value.keys())[0], str):\n                m_dict = gRPC_comm_manager_pb2.mDict_keyIsString()\n                key_type = 'string'\n            else:\n                m_dict = gRPC_comm_manager_pb2.mDict_keyIsInt()\n                key_type = 'int'\n\n            for key in value.keys():\n                m_dict.dict_value[key].MergeFrom(\n                    self.create_by_type(value[key], nested=True))\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                if key_type == 'string':\n                    msg_value.dict_msg_stringkey.MergeFrom(m_dict)\n                else:\n                    msg_value.dict_msg_intkey.MergeFrom(m_dict)\n                return msg_value\n            else:\n                return m_dict\n        elif isinstance(value, list) or isinstance(value, tuple):\n            m_list = gRPC_comm_manager_pb2.mList()\n            for each in value:\n                m_list.list_value.append(self.create_by_type(each,\n                                                             nested=True))\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                msg_value.list_msg.MergeFrom(m_list)\n                return msg_value\n            else:\n                return m_list\n        else:\n            m_single = gRPC_comm_manager_pb2.mSingle()\n            if type(value) in [int, np.int32]:\n                m_single.int_value = value\n            elif type(value) in [str]:\n                m_single.str_value = value\n            elif type(value) in [float, np.float32]:\n                m_single.float_value = value\n            else:\n                raise ValueError(\n                    'The data type {} has not been supported.'.format(\n                        type(value)))\n\n            if nested:\n                msg_value = gRPC_comm_manager_pb2.MsgValue()\n                msg_value.single_msg.MergeFrom(m_single)\n                return msg_value\n            else:\n                return m_single\n\n    def build_msg_value(self, value):\n        msg_value = gRPC_comm_manager_pb2.MsgValue()\n\n        if isinstance(value, list) or isinstance(value, tuple):\n            msg_value.list_msg.MergeFrom(self.create_by_type(value))\n        elif isinstance(value, dict):\n            if isinstance(list(value.keys())[0], str):\n                msg_value.dict_msg_stringkey.MergeFrom(\n                    self.create_by_type(value))\n            else:\n                msg_value.dict_msg_intkey.MergeFrom(self.create_by_type(value))\n        else:\n            msg_value.single_msg.MergeFrom(self.create_by_type(value))\n\n        return msg_value\n\n    def transform(self, to_list=False):\n        if to_list:\n            self.content = self.transform_to_list(self.content)\n\n        splited_msg = gRPC_comm_manager_pb2.MessageRequest()  # map/dict\n        splited_msg.msg['sender'].MergeFrom(self.build_msg_value(self.sender))\n        splited_msg.msg['receiver'].MergeFrom(\n            self.build_msg_value(self.receiver))\n        splited_msg.msg['state'].MergeFrom(self.build_msg_value(self.state))\n        splited_msg.msg['msg_type'].MergeFrom(\n            self.build_msg_value(self.msg_type))\n        splited_msg.msg['content'].MergeFrom(self.build_msg_value(\n            self.content))\n        splited_msg.msg['timestamp'].MergeFrom(\n            self.build_msg_value(self.timestamp))\n        return splited_msg\n\n    def _parse_msg(self, value):\n        if isinstance(value, gRPC_comm_manager_pb2.MsgValue) or isinstance(\n                value, gRPC_comm_manager_pb2.mSingle):\n            return self._parse_msg(getattr(value, value.WhichOneof(\"type\")))\n        elif isinstance(value, gRPC_comm_manager_pb2.mList):\n            return [self._parse_msg(each) for each in value.list_value]\n        elif isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsString) or \\\n                isinstance(value, gRPC_comm_manager_pb2.mDict_keyIsInt):\n            return {\n                k: self._parse_msg(value.dict_value[k])\n                for k in value.dict_value\n            }\n        else:\n            return value\n\n    def parse(self, received_msg):\n        self.sender = self._parse_msg(received_msg['sender'])\n        self.receiver = self._parse_msg(received_msg['receiver'])\n        self.msg_type = self._parse_msg(received_msg['msg_type'])\n        self.state = self._parse_msg(received_msg['state'])\n        self.content = self._parse_msg(received_msg['content'])\n        self.timestamp = self._parse_msg(received_msg['timestamp'])\n\n    def count_bytes(self):\n        \"\"\"\n            calculate the message bytes to be sent/received\n        :return: tuple of bytes of the message to be sent and received\n        \"\"\"\n        from pympler import asizeof\n        download_bytes = asizeof.asizeof(self.content)\n        upload_cnt = len(self.receiver) if isinstance(self.receiver,\n                                                      list) else 1\n        upload_bytes = download_bytes * upload_cnt\n        return download_bytes, upload_bytes\n", "path": "federatedscope/core/message.py"}]}