code: def beta(returns, factor_returns, risk_free=0.0):
      """Calculates beta.
  
      Parameters
      ----------
      returns : pd.Series
          Daily returns of the strategy, noncumulative.
          - See full explanation in :func:`~empyrical.stats.cum_returns`.
      factor_returns : pd.Series
           Daily noncumulative returns of the factor to which beta is
           computed. Usually a benchmark such as the market.
           - This is in the same style as returns.
      risk_free : int, float, optional
          Constant risk-free return throughout the period. For example, the
          interest rate on a three month us treasury bill.
  
      Returns
      -------
      float
          Beta.
      """
      if len(returns) < 2 or len(factor_returns) < 2:
          return np.nan
  
      return beta_aligned(
          *_aligned_series(returns, factor_returns), risk_free=risk_free
      )
  
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 22 for calling a global function with example usage: beta(returns, factor_returns, risk_free) and returns: beta_aligned, np