def path_to_key(datastore, path):
 key_parts = []
 path_parts = path.strip(u'/').split(u'/')
 for (n, x) in enumerate(path_parts):
  (name, ext) = x.rsplit('.', 1)
  key_parts.extend([ext, name])
 return datastore.key(*key_parts)

def path_to_key ( datastore , path ) : key_parts = [ ] path_parts = path . strip ( u'/' ) . split ( u'/' ) for ( n , x ) in enumerate ( path_parts ) : ( name , ext ) = x . rsplit ( '.' , 1 ) key_parts . extend ( [ ext , name ] ) return datastore . key ( * key_parts )
translates a file system path to a datastore key .