new_contents: class Solution(object):
  
      # Solution using double BFS
  
      def findLadders(self, begin, end, words_list):
          
          def construct_paths(source, dest, tree):
              if source == dest: 
                  return [[source]]
              return [[source] + path for succ in tree[source]
                                      for path in construct_paths(succ, dest, tree)]
  
          def add_path(tree, word, neigh, is_forw):
              if is_forw: tree[word]  += neigh,
              else:       tree[neigh] += word,
  
          def bfs_level(this_lev, oth_lev, tree, is_forw, words_set):
              if not this_lev: return False
              if len(this_lev) > len(oth_lev):
                  return bfs_level(oth_lev, this_lev, tree, not is_forw, words_set)
              for word in (this_lev | oth_lev):
                  words_set.discard(word)
              next_lev, done = set(), False
              while this_lev:
                  word = this_lev.pop()
                  for c in string.ascii_lowercase:
                      for index in range(len(word)):
                          neigh = word[:index] + c + word[index+1:]
                          if neigh in oth_lev:
                              done = True
                              add_path(tree, word, neigh, is_forw)                
                          if not done and neigh in words_set:
                              next_lev.add(neigh)
                              add_path(tree, word, neigh, is_forw)
              return done or bfs_level(next_lev, oth_lev, tree, is_forw, words_set)
                              
          tree, path, paths = collections.defaultdict(list), [begin], []
          is_found = bfs_level(set([begin]), set([end]), tree, True, words_list)
          return construct_paths(begin, end, tree)
  
subject: Create Word_Ladder_2.py