comefrom: <qiyuangong>290_Word_Pattern_1.py
code: def wordPattern( pattern, str):
      if pattern is None or str is None:
          return True
      words_to_pattern = {}
      pattern_to_words = {}
      word_list = str.split(' ')
      if len(word_list) != len(pattern):
          return False
      for index, word in enumerate(word_list):
          curr_p = pattern[index]
          if pattern_to_words.get(curr_p, word) != word or words_to_pattern.get(word, curr_p) != curr_p:
              return False
          pattern_to_words[curr_p] = pattern_to_words.get(curr_p, word)
          words_to_pattern[word] = words_to_pattern.get(word, curr_p)
      return True
masked: def sample_funcname ( var_0 , var_1 ) :
      if var_0 is None or var_1 is None :
          return True
      var_2 = { }
      var_3 = { }
      var_4 = var_1.split ( ' ' )
      if len ( var_4 ) != len ( var_0 ) :
          return False
      for var_5 , var_6 in enumerate ( var_4 ) :
          var_7 = var_0 [ var_5 ]
          if var_3.get ( var_7 , var_6 ) != var_6 or var_2.get ( var_6 , var_7 ) != var_7 :
              return False
          var_3 [ var_7 ] = var_3.get ( var_7 , var_6 )
          var_2 [ var_6 ] = var_2.get ( var_6 , var_7 )
      return True
  