code: def test_callable_args(func, args):
      """
      Return True when this function can be called with the given arguments.
      """
      assert isinstance(args, (list, tuple))
      signature = getattr(inspect, "signature", None)
  
      if signature is not None:
          # For Python 3, use inspect.signature.
          try:
              sig = _signatures_cache[func]
          except KeyError:
              sig = signature(func)
              _signatures_cache[func] = sig
  
          try:
              sig.bind(*args)
          except TypeError:
              return False
          else:
              return True
      else:
          # For older Python versions, fall back to using getargspec.
          spec = inspect.getargspec(func)
  
          # Drop the 'self'
          def drop_self(spec):
              args, varargs, varkw, defaults = spec
              if args[0:1] == ["self"]:
                  args = args[1:]
              return inspect.ArgSpec(args, varargs, varkw, defaults)
  
          spec = drop_self(spec)
  
          # When taking *args, always return True.
          if spec.varargs is not None:
              return True
  
          # Test whether the given amount of args is between the min and max
          # accepted argument counts.
          return (
              len(spec.args) - len(spec.defaults or [])
              <= len(args)
              <= len(spec.args)
          )
  
imports: from __future__ import unicode_literals
  import inspect
  import os
  import signal
  import sys
  import threading
  import weakref
  from wcwidth import wcwidth
  from six.moves import range
label_desc: Use image node_id 1 for calling a global function with example usage: test_callable_args(func, args) and returns: unknown, True, inspect, True, False