code: def get_max_drawdown_underwater(underwater):
      """
      Determines peak, valley, and recovery dates given an 'underwater'
      DataFrame.
  
      An underwater DataFrame is a DataFrame that has precomputed
      rolling drawdown.
  
      Parameters
      ----------
      underwater : pd.Series
         Underwater returns (rolling drawdown) of a strategy.
  
      Returns
      -------
      peak : datetime
          The maximum drawdown's peak.
      valley : datetime
          The maximum drawdown's valley.
      recovery : datetime
          The maximum drawdown's recovery.
      """
  
      valley = underwater.idxmin()  # end of the period
      # Find first 0
      peak = underwater[:valley][underwater[:valley] == 0].index[-1]
      # Find last 0
      try:
          recovery = underwater[valley:][
              underwater[valley:] == 0
          ].index[0]
      except IndexError:
          recovery = np.nan  # drawdown not recovered
      return peak, valley, recovery
  
imports: from __future__ import division
  from collections import OrderedDict
  from functools import partial
  import empyrical
  import numpy
  import pandas
  import scipy
  import scipy.stats
  from sklearn import linear_model
  from .deprecate import deprecated
  from .interesting_periods import PERIODS
  from .txn import get_turnover
  from .utils import APPROX_BDAYS_PER_MONTH, APPROX_BDAYS_PER_YEAR
  from .utils import DAILY
label_desc: Use image node_id 27 for calling a global function with example usage: get_max_drawdown_underwater(underwater) and returns: peak,  valley,  recovery