code: def is_callable(val):
      
      # python 3.x with x <= 2 does not support callable(), apparently
      if sys.version_info[0] == 3 and sys.version_info[1] <= 2:
          return hasattr(val, '__call__')
      else:
          return callable(val)
docs: Checks whether a variable is a callable, e.g. a function.
  
      Parameters
      ----------
      val
          The variable to check.
  
      Returns
      -------
      bool
          True if the variable is a callable. Otherwise False.