def matcher(pattern, txt):
 if txt.endswith(pattern):
  txt = txt[:txt.rfind(pattern)].strip()
  return ((not txt) or txt.endswith('"'))
 else:
  return False

def matcher ( pattern , txt ) : if txt . endswith ( pattern ) : txt = txt [ : txt . rfind ( pattern ) ] . strip ( ) return ( ( not txt ) or txt . endswith ( '"' ) ) else : return False
return true if pattern is sufficiently equal to txt .