code: def down(returns, factor_returns, **kwargs):
      """
      Calculates a given statistic filtering only negative factor return periods.
  
      Parameters
      ----------
      returns : pd.Series or np.ndarray
          Daily returns of the strategy, noncumulative.
          - See full explanation in :func:`~empyrical.stats.cum_returns`.
      factor_returns (optional): float / series
          Benchmark return to compare returns against.
      function:
          the function to run for each rolling window.
      (other keywords): other keywords that are required to be passed to the
          function in the 'function' argument may also be passed in.
  
      Returns
      -------
      Same as the return of the 'function'
      """
      func = kwargs.pop("function")
      returns = returns[factor_returns < 0]
      factor_returns = factor_returns[factor_returns < 0]
      return func(returns, factor_returns, **kwargs)
  
imports: from datetime import datetime
  from functools import wraps
  from os import makedirs, environ
  from os.path import expanduser, join, getmtime, isdir
  import errno
  import warnings
  import numpy
  from numpy.lib.stride_tricks import as_strided
  import pandas
  from pandas.tseries.offsets import BDay
  from .deprecate import deprecated
label_desc: Use image node_id 3 for calling a global function with example usage: down(returns, factor_returns) and returns: func