code: def perf_stats_bootstrap(returns, factor_returns=None, return_stats=True,
                           **kwargs):
      
  
      bootstrap_values = OrderedDict()
  
      for stat_func in SIMPLE_STAT_FUNCS:
          stat_name = STAT_FUNC_NAMES[stat_func.__name__]
          bootstrap_values[stat_name] = calc_bootstrap(stat_func,
                                                       returns)
  
      if factor_returns is not None:
          for stat_func in FACTOR_STAT_FUNCS:
              stat_name = STAT_FUNC_NAMES[stat_func.__name__]
              bootstrap_values[stat_name] = calc_bootstrap(
                  stat_func,
                  returns,
                  factor_returns=factor_returns)
  
      bootstrap_values = pd.DataFrame(bootstrap_values)
  
      if return_stats:
          stats = bootstrap_values.apply(calc_distribution_stats)
          return stats.T[['mean', 'median', '5%', '95%']]
      else:
          return bootstrap_values
docs: Calculates various bootstrapped performance metrics of a strategy.
  
      Parameters
      ----------
      returns : pd.Series
          Daily returns of the strategy, noncumulative.
           - See full explanation in tears.create_full_tear_sheet.
      factor_returns : pd.Series, optional
          Daily noncumulative returns of the benchmark factor to which betas are
          computed. Usually a benchmark such as market returns.
           - This is in the same style as returns.
           - If None, do not compute alpha, beta, and information ratio.
      return_stats : boolean (optional)
          If True, returns a DataFrame of mean, median, 5 and 95 percentiles
          for each perf metric.
          If False, returns a DataFrame with the bootstrap samples for
          each perf metric.
  
      Returns
      -------
      pd.DataFrame
          if return_stats is True:
          - Distributional statistics of bootstrapped sampling
          distribution of performance metrics.
          if return_stats is False:
          - Bootstrap samples for each performance metric.