code: def deprecated(conditional=True):
      """
      Filter deprecation warnings while running the test suite.
  
      This decorator can be used to filter DeprecationWarning's, to avoid
      printing them during the test suite run, while checking that the test
      actually raises a DeprecationWarning.
  
      Parameters
      ----------
      conditional : bool or callable, optional
          Flag to determine whether to mark test as deprecated or not. If the
          condition is a callable, it is used at runtime to dynamically make the
          decision. Default is True.
  
      Returns
      -------
      decorator : function
          The `deprecated` decorator itself.
  
      Notes
      -----
      .. versionadded:: 1.4.0
  
      """
  
      def deprecate_decorator(f):
          # Local import to avoid a hard nose dependency and only incur the
          # import time overhead at actual test-time.
          import nose
  
          def _deprecated_imp(*args, **kwargs):
              # Poor man's replacement for the with statement
              ctx = WarningManager(record=True)
              l = ctx.__enter__()
              warnings.simplefilter("always")
              try:
                  f(*args, **kwargs)
                  if not len(l) > 0:
                      raise AssertionError(
                          "No warning raised when calling %s"
                          % f.__name__
                      )
                  if not l[0].category is DeprecationWarning:
                      raise AssertionError(
                          "First warning for %s is not a "
                          "DeprecationWarning( is %s)"
                          % (f.__name__, l[0])
                      )
              finally:
                  ctx.__exit__()
  
          if callable(conditional):
              cond = conditional()
          else:
              cond = conditional
          if cond:
              return nose.tools.make_decorator(f)(_deprecated_imp)
          else:
              return f
  
      return deprecate_decorator
  
imports: import warnings
  from ._numpy_testing_utils import WarningManager
label_desc: Use image node_id 5 for calling a global function with example usage: deprecated(conditional) and returns: deprecate_decorator, nose, f