code: def _form_master_re(relist, reflags, ldict, toknames):
      if not relist:
          return []
      regex = "|".join(relist)
      try:
          lexre = re.compile(regex, reflags)
  
          # Build the index to function map for the matching engine
          lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1)
          lexindexnames = lexindexfunc[:]
  
          for f, i in lexre.groupindex.items():
              handle = ldict.get(f, None)
              if type(handle) in (types.FunctionType, types.MethodType):
                  lexindexfunc[i] = (handle, toknames[f])
                  lexindexnames[i] = f
              elif handle is not None:
                  lexindexnames[i] = f
                  if f.find("ignore_") > 0:
                      lexindexfunc[i] = (None, None)
                  else:
                      lexindexfunc[i] = (None, toknames[f])
  
          return [(lexre, lexindexfunc)], [regex], [lexindexnames]
      except Exception:
          m = int(len(relist) / 2)
          if m == 0:
              m = 1
          llist, lre, lnames = _form_master_re(
              relist[:m], reflags, ldict, toknames
          )
          rlist, rre, rnames = _form_master_re(
              relist[m:], reflags, ldict, toknames
          )
          return (llist + rlist), (lre + rre), (lnames + rnames)
  
imports: import re
  import sys
  import types
  import copy
  import os
  import inspect
label_desc: Use image node_id 5 for calling a global function with example usage: _form_master_re(relist, reflags, ldict, toknames) and returns: list, list,  list,  list, unknown,  unknown,  unknown