code: def prepare_definitions(groups):
      """
      Prepare the function definitions from the YAML file into definitions that can be rendered into
      templates. Validation should also occur in this function.
  
      Currently, this function only performs validation. Looking forward, it can be used for
      preprocessing to handle features like multiple optional arguments and overloaded function
      definitions.
      """
  
      required_fields = ["name", "doc", "since", "expr_class"]
      for group in groups.values():
          for function in group["functions"]:
              for field in required_fields:
                  check_field_defined(function, field)
              for i, arg in enumerate(function["args"]):
                  if arg.get("is_optional"):
                      assert (
                          i == len(function["args"]) - 1
                      ), f"Only the last argument in the argument"
                      "list can be optional ({arg})"
                  if arg.get("is_var_args"):
                      assert (
                          i == len(function["args"]) - 1
                      ), f"Only the last argument in the argument"
                      "list can be var args"
      return groups
  
file_path: glow/python/render_template.py
imports: import argparse
  import jinja2
  import yaml
label_desc: Use image node_id 8 for calling a global function with example usage: prepare_definitions(groups) and returns: groups