def EvaluatePrefix(prefix, path_regex):
 if path_regex.match(prefix):
  return 'MATCH'
 path_regex_string = path_regex.pattern
 if (not path_regex_string.startswith(KNOWN_PATH_REGEX_PREFIX)):
  logging.warning('Unrecognized regex format, being pessimistic: %s', path_regex_string)
  return 'POSSIBLE'
 literal_prefix = _LiteralPrefix(path_regex_string[len(KNOWN_PATH_REGEX_PREFIX):])
 if literal_prefix.startswith(prefix):
  return 'POSSIBLE'
 if prefix.startswith(literal_prefix):
  return 'POSSIBLE'
 return 'NO_MATCH'

def EvaluatePrefix ( prefix , path_regex ) : if path_regex . match ( prefix ) : return 'MATCH' path_regex_string = path_regex . pattern if ( not path_regex_string . startswith ( KNOWN_PATH_REGEX_PREFIX ) ) : logging . warning ( 'Unrecognized regex format, being pessimistic: %s' , path_regex_string ) return 'POSSIBLE' literal_prefix = _LiteralPrefix ( path_regex_string [ len ( KNOWN_PATH_REGEX_PREFIX ) : ] ) if literal_prefix . startswith ( prefix ) : return 'POSSIBLE' if prefix . startswith ( literal_prefix ) : return 'POSSIBLE' return 'NO_MATCH'
estimate if subjects beginning with prefix might match path_regex .