code: def ensure_boolean(arg):
      
      if not isinstance(arg, bool):
          raise TypeError("expected a boolean, got %s" % type(arg).__name__)
      return arg
docs: Checks whether given argument is a boolean value.
      :return: Argument, if it's a boolean
      :raise TypeError: When argument is not a boolean
  
      .. versionadded:: 0.0.3