def AsDict(self):  # pragma: no cover
  """Converts ndb Model to a dict."""
  ret = {}
  for key in self._properties:
    value = getattr(self, key)
    if isinstance(value, (int, None.__class__, float)):
      ret[key] = value
    else:
      ret[key] = str(value)
  key = self.key
  if key:
    ret['key'] = key.string_id() or key.integer_id()
    if key.parent():
      ret['parent_key'] = key.parent().string_id() or key.parent().integer_id()
  return ret