code: def cum_returns_final(returns, starting_value=0):
      """
      Compute total returns from simple returns.
  
      Parameters
      ----------
      returns : pd.DataFrame, pd.Series, or np.ndarray
         Noncumulative simple returns of one or more timeseries.
      starting_value : float, optional
         The starting returns.
  
      Returns
      -------
      total_returns : pd.Series, np.ndarray, or float
          If input is 1-dimensional (a Series or 1D numpy array), the result is a
          scalar.
  
          If input is 2-dimensional (a DataFrame or 2D numpy array), the result
          is a 1D array containing cumulative returns for each column of input.
      """
      if len(returns) == 0:
          return np.nan
  
      if isinstance(returns, pd.DataFrame):
          result = (returns + 1).prod()
      else:
          result = np.nanprod(returns + 1, axis=0)
  
      if starting_value == 0:
          result -= 1
      else:
          result *= starting_value
  
      return result
  
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 8 for calling a global function with example usage: cum_returns_final(returns, starting_value) and returns: result, np