code: def compile_matchers(formatcode):
      
      matchers = {}
      for node_type in ["leaf", "single", "internal"]:
          if node_type == "leaf" or node_type == "single":
              container1 = NW_FORMAT[formatcode][0][0]
              container2 = NW_FORMAT[formatcode][1][0]
              converterFn1 = NW_FORMAT[formatcode][0][1]
              converterFn2 = NW_FORMAT[formatcode][1][1]
              flexible1 = NW_FORMAT[formatcode][0][2]
              flexible2 = NW_FORMAT[formatcode][1][2]
          else:
              container1 = NW_FORMAT[formatcode][2][0]
              container2 = NW_FORMAT[formatcode][3][0]
              converterFn1 = NW_FORMAT[formatcode][2][1]
              converterFn2 = NW_FORMAT[formatcode][3][1]
              flexible1 = NW_FORMAT[formatcode][2][2]
              flexible2 = NW_FORMAT[formatcode][3][2]
  
          if converterFn1 == str:
              FIRST_MATCH = "("+_NAME_RE+")"
          elif converterFn1 == float:
              FIRST_MATCH = "("+_FLOAT_RE+")"
          elif converterFn1 is None:
              FIRST_MATCH = '()'
  
          if converterFn2 == str:
              SECOND_MATCH = "(:"+_NAME_RE+")"
          elif converterFn2 == float:
              SECOND_MATCH = "(:"+_FLOAT_RE+")"
          elif converterFn2 is None:
              SECOND_MATCH = '()'
  
          if flexible1 and node_type != 'leaf':
              FIRST_MATCH += "?"
          if flexible2:
              SECOND_MATCH += "?"
  
          matcher_str= '^\s*%s\s*%s\s*(%s)?\s*$' % (FIRST_MATCH, SECOND_MATCH, _NHX_RE)
          compiled_matcher = re.compile(matcher_str)
          matchers[node_type] = [container1, container2, converterFn1, converterFn2, compiled_matcher]
  
      return matchers
docs: Tests newick string against format types? and makes a re.compile