code: def name_match_funcdef_handle(self, original, loc, tokens):
          
          if len(tokens) == 2:
              func, matches = tokens
              cond = None
          elif len(tokens) == 3:
              func, matches, cond = tokens
          else:
              raise CoconutInternalException("invalid match function definition tokens", tokens)
          matcher = Matcher(loc, match_check_var)
  
          req_args, def_args, star_arg, kwd_args, dubstar_arg = split_args_list(matches, loc)
          matcher.match_function(match_to_args_var, match_to_kwargs_var, req_args + def_args, star_arg, kwd_args, dubstar_arg)
  
          if cond is not None:
              matcher.add_guard(cond)
  
          before_docstring = (
              "def " + func
              + "(*" + match_to_args_var + ", **" + match_to_kwargs_var + "):\n"
              + openindent
          )
          after_docstring = (
              match_check_var + " = False\n"
              + matcher.out()
              # we only include match_to_args_var here because match_to_kwargs_var is modified during matching
              + self.pattern_error(original, loc, match_to_args_var, match_check_var) + closeindent
          )
          return before_docstring, after_docstring
docs: Process match defs. Result must be passed to insert_docstring_handle.