code: def get_characteristic_subpattern(subpatterns):
      """Picks the most characteristic from a list of linear patterns
      Current order used is:
      names > common_names > common_chars
      """
      if not isinstance(subpatterns, list):
          return subpatterns
      if len(subpatterns) == 1:
          return subpatterns[0]
  
      # first pick out the ones containing variable names
      subpatterns_with_names = []
      subpatterns_with_common_names = []
      common_names = ["in", "for", "if", "not", "None"]
      subpatterns_with_common_chars = []
      common_chars = "[]().,:"
      for subpattern in subpatterns:
          if any(rec_test(subpattern, lambda x: type(x) is str)):
              if any(
                  rec_test(
                      subpattern,
                      lambda x: isinstance(x, str)
                      and x in common_chars,
                  )
              ):
                  subpatterns_with_common_chars.append(subpattern)
              elif any(
                  rec_test(
                      subpattern,
                      lambda x: isinstance(x, str)
                      and x in common_names,
                  )
              ):
                  subpatterns_with_common_names.append(subpattern)
  
              else:
                  subpatterns_with_names.append(subpattern)
  
      if subpatterns_with_names:
          subpatterns = subpatterns_with_names
      elif subpatterns_with_common_names:
          subpatterns = subpatterns_with_common_names
      elif subpatterns_with_common_chars:
          subpatterns = subpatterns_with_common_chars
      # of the remaining subpatterns pick out the longest one
      return max(subpatterns, key=len)
  
file_path: catboost/contrib/tools/python/src/Lib/lib2to3/btm_utils.py
imports: from .None import pytree
  from .pgen2 import grammar, token
  from .pygram import pattern_symbols, python_symbols
label_desc: Use image node_id 2 for calling a global function with example usage: get_characteristic_subpattern(subpatterns) and returns: max, subpatterns, subpatterns