def _NamespaceKeyToString(key):
 key_path = key.to_path()
 if ((len(key_path) == 2) and (key_path[0] == '__namespace__')):
  if (key_path[1] == datastore_types._EMPTY_NAMESPACE_ID):
   return ''
  if isinstance(key_path[1], basestring):
   return key_path[1]
 Check(False, 'invalid Key for __namespace__ table')

def _NamespaceKeyToString ( key ) : key_path = key . to_path ( ) if ( ( len ( key_path ) == 2 ) and ( key_path [ 0 ] == '__namespace__' ) ) : if ( key_path [ 1 ] == datastore_types . _EMPTY_NAMESPACE_ID ) : return '' if isinstance ( key_path [ 1 ] , basestring ) : return key_path [ 1 ] Check ( False , 'invalid Key for __namespace__ table' )
extract namespace name from __namespace__ key .