code: def _nargs_validator(nargs, message):
      """Makes validator for function to ensure it takes nargs args."""
      if message is None:
          message = (
              "Registered function must take exactly %d arguments"
              % nargs
          )
  
      def f(key, value):
          del key
          spec = inspect.getfullargspec(value)
          if (
              len(spec.args) != nargs
              or spec.varargs is not None
              or spec.varkw is not None
          ):
              raise ValueError(message)
  
      return f
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from tensor2tensor.utils import misc_utils
  import tensorflow.compat.v1
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 3 for calling a global function with example usage: _nargs_validator(nargs, message) and returns: f