docs: def encode(self, entity):
          """
          Encodes the data, creating a JSON structure from an instance from the
          domain model.
  
          :param entity: the instance to encode
          :return: a JSON structure created from the received data
          """
          encoded = self._dict_encoder.encode(entity)
  
          if sys.version_info[0] == 2:
              result = json.dumps(encoded, ensure_ascii=False,
                                  default=_iso_handler, encoding='latin1')
          else:
              # For Python 3
              result = json.dumps(encoded, ensure_ascii=False,
                                  default=_iso_handler)
  
          return result