code: def sharpe_ratio(
      returns, risk_free=0, period=DAILY, annualization=None, out=None
  ):
      """
      Determines the Sharpe ratio of a strategy.
  
      Parameters
      ----------
      returns : pd.Series or np.ndarray
          Daily returns of the strategy, noncumulative.
          - See full explanation in :func:`~empyrical.stats.cum_returns`.
      risk_free : int, float
          Constant daily risk-free return throughout the period.
      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`.
      out : array-like, optional
          Array to use as output buffer.
          If not passed, a new array will be created.
  
      Returns
      -------
      sharpe_ratio : float
          nan if insufficient length of returns or if if adjusted returns are 0.
  
      Note
      -----
      See https://en.wikipedia.org/wiki/Sharpe_ratio for more details.
  
      """
      allocated_output = out is None
      if allocated_output:
          out = np.empty(returns.shape[1:])
  
      return_1d = returns.ndim == 1
  
      if len(returns) < 2:
          out[()] = np.nan
          if return_1d:
              out = out.item()
          return out
  
      returns_risk_adj = np.asanyarray(
          _adjust_returns(returns, risk_free)
      )
      ann_factor = annualization_factor(period, annualization)
  
      np.multiply(
          np.divide(
              nanmean(returns_risk_adj, axis=0),
              nanstd(returns_risk_adj, ddof=1, axis=0),
              out=out,
          ),
          np.sqrt(ann_factor),
          out=out,
      )
      if return_1d:
          out = out.item()
  
      return out
  
imports: from __future__ import division
  import math
  import pandas
  import numpy
  from math import pow
  from scipy import stats, optimize
  from six import iteritems
  from sys import float_info
  from .utils import nanmean, nanstd, nanmin, up, down, roll, rolling_window
  from .periods import ANNUALIZATION_FACTORS, APPROX_BDAYS_PER_YEAR
  from .periods import DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY
label_desc: Use image node_id 16 for calling a global function with example usage: sharpe_ratio(returns, risk_free, period, annualization, out) and returns: out, out