code: def make_ufuncs(funcdict):
      code3list = []
      names = sorted(funcdict.keys())
      for name in names:
          uf = funcdict[name]
          mlist = []
          if uf.signature is None:
              sig = "NULL"
          else:
              sig = '"{}"'.format(uf.signature)
          fmt = textwrap.dedent(
              """\
              identity = {identity_expr};
              if ({has_identity} && identity == NULL) {{
                  return -1;
              }}
              f = PyUFunc_FromFuncAndDataAndSignatureAndIdentity(
                  {funcs}, {data}, {signatures}, {nloops},
                  {nin}, {nout}, {identity}, "{name}",
                  {doc}, 0, {sig}, identity
              );
              if ({has_identity}) {{
                  Py_DECREF(identity);
              }}
              if (f == NULL) {{
                  return -1;
              }}
          """
          )
          args = dict(
              name=name,
              funcs=f"{name}_functions" if not uf.empty else "NULL",
              data=f"{name}_data" if not uf.empty else "NULL",
              signatures=f"{name}_signatures"
              if not uf.empty
              else "NULL",
              nloops=len(uf.type_descriptions),
              nin=uf.nin,
              nout=uf.nout,
              has_identity="0" if uf.identity is None_ else "1",
              identity="PyUFunc_IdentityValue",
              identity_expr=uf.identity,
              doc=uf.docstring,
              sig=sig,
          )
  
          # Only PyUFunc_None means don't reorder - we pass this using the old
          # argument
          if uf.identity is None_:
              args["identity"] = "PyUFunc_None"
              args["identity_expr"] = "NULL"
  
          mlist.append(fmt.format(**args))
          if uf.typereso is not None:
              mlist.append(
                  r"((PyUFuncObject *)f)->type_resolver = &%s;"
                  % uf.typereso
              )
          for c in uf.indexed:
              # Handle indexed loops by getting the underlying ArrayMethodObject
              # from the list in f._loops and setting its field appropriately
              fmt = textwrap.dedent(
                  """
              {{
                  PyArray_DTypeMeta *dtype = PyArray_DTypeFromTypeNum({typenum});
                  PyObject *info = get_info_no_cast((PyUFuncObject *)f,
                                                     dtype, {count});
                  if (info == NULL) {{
                      return -1;
                  }}
                  if (info == Py_None) {{
                      PyErr_SetString(PyExc_RuntimeError,
                          "cannot add indexed loop to ufunc "
                          "{name} with {typenum}");
                      return -1;
                  }}
                  if (!PyObject_TypeCheck(info, &PyArrayMethod_Type)) {{
                      PyErr_SetString(PyExc_RuntimeError,
                          "Not a PyArrayMethodObject in ufunc "
                          "{name} with {typenum}");
                  }}
                  ((PyArrayMethodObject*)info)->contiguous_indexed_loop =
                                                                   {funcname};
                  /* info is borrowed, no need to decref*/
              }}
              """
              )
              mlist.append(
                  fmt.format(
                      typenum=f"NPY_{english_upper(chartoname[c])}",
                      count=uf.nin + uf.nout,
                      name=name,
                      funcname=f"{english_upper(chartoname[c])}_{name}_indexed",
                  )
              )
  
          mlist.append(
              r"""PyDict_SetItemString(dictionary, "%s", f);""" % name
          )
          mlist.append(r"""Py_DECREF(f);""")
          code3list.append("\n".join(mlist))
      return "\n".join(code3list)
  
imports: import os
  import re
  import struct
  import sys
  import textwrap
  import argparse
  import string
label_desc: Use image node_id 8 for calling a global function with example usage: make_ufuncs(funcdict) and returns: str