def __create_instance(self, input_dict, bulkload_state):
    key = None
    if self._create_key:
      key = self.__dict_to_prop(self._create_key, input_dict, bulkload_state)
      if isinstance(key, (int, long)):
        key = datastore.Key.from_path(self._transformer_spec.kind, key)
      if self._transformer_spec.model:
        if isinstance(key, datastore.Key):
          return self._transformer_spec.model(key=key)
        else:
          return self._transformer_spec.model(key_name=key)
      else:
        if isinstance(key, datastore.Key):
          parent = key.parent()
          if key.name() is None:
            return datastore.Entity(self._transformer_spec.kind,
                                    parent=parent, id=key.id())
          else:
            return datastore.Entity(self._transformer_spec.kind,
                                    parent=parent, name=key.name())
    elif self._transformer_spec.model:
      return self._transformer_spec.model()

    return datastore.Entity(self._transformer_spec.kind, name=key)
Return a model instance or entity from an input_dict.
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/bulkload/bulkloader_config.py/DictConvertor.__create_instance