def get_kind_key(prefix, key_path):
 path = []
 path.append(key_path.element_list()[(-1)].type())
 for e in key_path.element_list():
  if e.has_name():
   key_id = e.name()
  else:
   key_id = str(e.id()).zfill(ID_KEY_LENGTH)
  path.append('{0}{2}{1}'.format(e.type(), key_id, dbconstants.ID_SEPARATOR))
 encoded_path = dbconstants.KIND_SEPARATOR.join(path)
 encoded_path += dbconstants.KIND_SEPARATOR
 return ((prefix + dbconstants.KEY_DELIMITER) + encoded_path)

def get_kind_key ( prefix , key_path ) : path = [ ] path . append ( key_path . element_list ( ) [ ( - 1 ) ] . type ( ) ) for e in key_path . element_list ( ) : if e . has_name ( ) : key_id = e . name ( ) else : key_id = str ( e . id ( ) ) . zfill ( ID_KEY_LENGTH ) path . append ( '{0}{2}{1}' . format ( e . type ( ) , key_id , dbconstants . ID_SEPARATOR ) ) encoded_path = dbconstants . KIND_SEPARATOR . join ( path ) encoded_path += dbconstants . KIND_SEPARATOR return ( ( prefix + dbconstants . KEY_DELIMITER ) + encoded_path )
returns a key for the kind table .