def KeyStr(key):
 assert isinstance(key, datastore.Key)
 path = key.to_path()
 out_path = []
 for part in path:
  if isinstance(part, (int, long)):
   part = ('%020d' % part)
  else:
   part = (':%s' % part)
  out_path.append(zero_matcher.sub(u'\x00\x01', part))
 out_str = u'\x00\x00'.join(out_path)
 return out_str

def KeyStr ( key ) : assert isinstance ( key , datastore . Key ) path = key . to_path ( ) out_path = [ ] for part in path : if isinstance ( part , ( int , long ) ) : part = ( '%020d' % part ) else : part = ( ':%s' % part ) out_path . append ( zero_matcher . sub ( u'\x00\x01' , part ) ) out_str = u'\x00\x00' . join ( out_path ) return out_str
returns a string to represent a key .