def pattern_matches(pattern, target):
 if (not isinstance(pattern, Pattern)):
  pattern = _compile_pattern(pattern)
 return pattern.matches(target)

def pattern_matches ( pattern , target ) : if ( not isinstance ( pattern , Pattern ) ) : pattern = _compile_pattern ( pattern ) return pattern . matches ( target )
verify that a target string matches the given pattern .