code: def drawdowns(returns, geometric=True):
      
      wealth = 1. + returns_cumulative(returns, geometric=geometric, expanding=True)
      values = wealth.values
      if values.ndim == 2:
          ncols = values.shape[-1]
          values = np.vstack(([1.] * ncols, values))
          maxwealth = pd.expanding_max(values)[1:]
          dds = wealth / maxwealth - 1.
          dds[dds > 0] = 0  # Can happen if first returns are positive
          return dds
      elif values.ndim == 1:
          values = np.hstack(([1.], values))
          maxwealth = pd.expanding_max(values)[1:]
          dds = wealth / maxwealth - 1.
          dds[dds > 0] = 0  # Can happen if first returns are positive
          return dds
      else:
          raise ValueError('unable to process array with %s dimensions' % values.ndim)
docs: compute the drawdown series for the period return series
      return: periodic return Series or DataFrame