code: def get_linear_subpattern(self):
          
  
          for l in self.leaves():
              subp = l.leaf_to_root()
              if subp:
                  return subp
docs: Drives the leaf_to_root method. The reason that
          leaf_to_root must be run multiple times is because we need to
          reject 'group' matches; for example the alternative form
          (a | b c) creates a group [b c] that needs to be matched. Since
          matching multiple linear patterns overcomes the automaton's
          capabilities, leaf_to_root merges each group into a single
          choice based on 'characteristic'ity,
  
          i.e. (a|b c) -> (a|b) if b more characteristic than c
  
          Returns: The most 'characteristic'(as defined by
            get_characteristic_subpattern) path for the compiled pattern
            tree.