code: def msquared(self, benchmark, rf=0.02, ddof=0):
          
  
          rf = self._validate_rf(rf)
          scaling = benchmark.anlzd_stdev(ddof) / self.anlzd_stdev(ddof)
          diff = self.anlzd_ret() - rf
          return rf + diff * scaling
docs: M-squared, return scaled by relative total risk.
  
          A measure of what a portfolio would have returned if it had
          taken on the same *total* risk as the market index.
          [Source: CFA Institute]
  
          Parameters
          ----------
          benchmark : {pd.Series, TSeries, 1d np.ndarray}
              The benchmark security to which `self` is compared.
          rf : {float, TSeries, pd.Series}, default 0.02
              If float, this represents an *compounded annualized*
              risk-free rate; 2.0% is the default.
              If a TSeries or pd.Series, this represents a time series
              of periodic returns to a risk-free security.
  
              To download a risk-free rate return series using
              3-month US T-bill yields, see:`pyfinance.datasets.load_rf`.
          ddof : int, default 0
              Degrees of freedom, passed to pd.Series.std().
  
          Returns
          -------
          float