def _XmlPatternToRegEx(xml_pattern):
 result = ['^']
 while xml_pattern:
  if xml_pattern.startswith('**'):
   result.append('.*')
   xml_pattern = xml_pattern[1:]
  elif xml_pattern.startswith('*'):
   result.append('[^/]*')
  elif xml_pattern.startswith('/'):
   result.append('/')
  else:
   result.append(re.escape(xml_pattern[0]))
  xml_pattern = xml_pattern[1:]
 result.append('$')
 return re.compile(''.join(result))

def _XmlPatternToRegEx ( xml_pattern ) : result = [ '^' ] while xml_pattern : if xml_pattern . startswith ( '**' ) : result . append ( '.*' ) xml_pattern = xml_pattern [ 1 : ] elif xml_pattern . startswith ( '*' ) : result . append ( '[^/]*' ) elif xml_pattern . startswith ( '/' ) : result . append ( '/' ) else : result . append ( re . escape ( xml_pattern [ 0 ] ) ) xml_pattern = xml_pattern [ 1 : ] result . append ( '$' ) return re . compile ( '' . join ( result ) )
translates an appengine-web .