code: def takes_arg(obj, arg: str) -> bool:
      """
      Checks whether the provided obj takes a certain arg.
      If it's a class, we're really checking whether its constructor does.
      If it's a function or method, we're checking the object itself.
      Otherwise, we raise an error.
      """
      if inspect.isclass(obj):
          signature = inspect.signature(obj.__init__)
      elif inspect.ismethod(obj) or inspect.isfunction(obj):
          signature = inspect.signature(obj)
      else:
          raise ConfigurationError(f"object {obj} is not callable")
      return arg in signature.parameters
  
imports: import collections.abc
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Callable, cast, Dict, Iterable, List, Mapping, Set, Tuple, Type, TypeVar, Union, Optional
  import inspect
  import logging
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.lazy import Lazy
  from allennlp.common.params import Params
label_desc: Use image node_id 1 for calling a global function with example usage: takes_arg(obj, arg) and returns: unknown