code: def nargs_error(name, takes, given):
      """Generate a TypeError to be raised by function calls with wrong arity."""
      return TypeError(
          f"{name}() takes {takes} positional arguments but "
          f"{given} were given"
      )
  
imports: import functools
  import itertools
  import re
  import sys
  import warnings
  from .deprecation import deprecated, warn_deprecated, rename_parameter, delete_parameter, make_keyword_only, deprecate_method_override, deprecate_privatize_attribute, suppress_matplotlib_deprecation_warning, MatplotlibDeprecationWarning
label_desc: Use image node_id 8 for calling a global function with example usage: nargs_error(name, takes, given) and returns: TypeError