code: def downside_risk(
      returns, required_return=0, period=DAILY, annualization=None
  ):
      """
      Determines the downside deviation below a threshold
  
      Parameters
      ----------
      returns : pd.Series or np.ndarray or pd.DataFrame
          Daily returns of the strategy, noncumulative.
          - See full explanation in :func:`~empyrical.stats.cum_returns`.
      required_return: float / series
          minimum acceptable return
      period : str, optional
          Defines the periodicity of the 'returns' data for purposes of
          annualizing. Value ignored if `annualization` parameter is specified.
          Defaults are:
              'monthly':12
              'weekly': 52
              'daily': 252
      annualization : int, optional
          Used to suppress default values available in `period` to convert
          returns into annual returns. Value should be the annual frequency of
          `returns`.
  
      Returns
      -------
      float, pd.Series
          depends on input type
          series ==> float
          DataFrame ==> pd.Series
  
          Annualized downside deviation
  
      """
  
      if len(returns) < 1:
          return np.nan
  
      ann_factor = annualization_factor(period, annualization)
  
      downside_diff = _adjust_returns(returns, required_return).copy()
      mask = downside_diff > 0
      downside_diff[mask] = 0.0
      squares = np.square(downside_diff)
      mean_squares = nanmean(squares, axis=0)
      dside_risk = np.sqrt(mean_squares) * np.sqrt(ann_factor)
  
      if len(returns.shape) == 2 and isinstance(returns, pd.DataFrame):
          dside_risk = pd.Series(dside_risk, index=returns.columns)
      return dside_risk
  
imports: from __future__ import division
  from functools import wraps
  import pandas
  import numpy
  from scipy import stats
  from six import iteritems
  from empyrical.utils import nanmean, nanstd, nanmin
label_desc: Use image node_id 15 for calling a global function with example usage: downside_risk(returns, required_return, period, annualization) and returns: dside_risk, np