def __init__(self, kind, parent=None, _app=None, name=None, id=None,
               unindexed_properties=[], _namespace=None):
    ref = entity_pb.Reference()
    _app_namespace = datastore_types.ResolveAppIdNamespace(_app, _namespace)
    ref.set_app(_app_namespace.to_encoded())

    datastore_types.ValidateString(kind, 'kind',
                                   datastore_errors.BadArgumentError)
    if parent is not None:
      parent = _GetCompleteKeyOrError(parent)
      if _app_namespace != parent.app_id_namespace():
        raise datastore_errors.BadArgumentError(
            " %s doesn't match parent's app_namespace %s" %
            (_app_namespace, parent.app_id_namespace()))
      ref.CopyFrom(parent._Key__reference)

    last_path = ref.mutable_path().add_element()
    last_path.set_type(kind.encode('utf-8'))

    if name is not None and id is not None:
      raise datastore_errors.BadArgumentError(
          "Cannot set both name and id on an Entity")

    if name is not None:
      datastore_types.ValidateString(name, 'name')
      last_path.set_name(name.encode('utf-8'))

    if id is not None:
      datastore_types.ValidateInteger(id, 'id')
      last_path.set_id(id)

    self.set_unindexed_properties(unindexed_properties)

    self.__key = Key._FromPb(ref)
Global function to access the couchbase connection (and make it if its closed)
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/datastore.py/Entity.__init__--crossover with--dataset/ETHPy150Open saltstack/salt/salt/returners/couchbase_return.py/_get_connection