code: def get_value_for_datastore(self, model_instance):
      
      value = super(JsonProperty, self).get_value_for_datastore(model_instance)
      if not value:
        return None
      json_value = value
      if not isinstance(value, dict):
        json_value = value.to_json()
      if not json_value:
        return None
      return datastore_types.Text(json.dumps(
          json_value, sort_keys=True, cls=JsonEncoder))
docs: Gets value for datastore.
  
      Args:
        model_instance: instance of the model class.
  
      Returns:
        datastore-compatible value.