code: def serialize(self, data: Dict, fields=None, toBytes=True):
          
          if isinstance(data, Dict):
              data = self._sort_dict(data)
          return msgpack.packb(data, use_bin_type=True)
docs: Serializes a dict to bytes preserving the order (in sorted order)
          :param data: the data to be serialized
          :return: serialized data as bytes