def v4_key_to_string(v4_key):
 path_element_strings = []
 for path_element in v4_key.path_element_list():
  if path_element.has_id():
   id_or_name = str(path_element.id())
  elif path_element.has_name():
   id_or_name = path_element.name()
  else:
   id_or_name = ''
  path_element_strings.append(('%s: %s' % (path_element.kind(), id_or_name)))
 return ('[%s]' % ', '.join(path_element_strings))

def v4_key_to_string ( v4_key ) : path_element_strings = [ ] for path_element in v4_key . path_element_list ( ) : if path_element . has_id ( ) : id_or_name = str ( path_element . id ( ) ) elif path_element . has_name ( ) : id_or_name = path_element . name ( ) else : id_or_name = '' path_element_strings . append ( ( '%s: %s' % ( path_element . kind ( ) , id_or_name ) ) ) return ( '[%s]' % ', ' . join ( path_element_strings ) )
generates a string representing a keys path .