code: def extract_interesting_date_ranges(returns, periods=None):
      """
      Extracts returns based on interesting events. See
      gen_date_range_interesting.
  
      Parameters
      ----------
      returns : pd.Series
          Daily returns of the strategy, noncumulative.
           - See full explanation in tears.create_full_tear_sheet.
  
      Returns
      -------
      ranges : OrderedDict
          Date ranges, with returns, of all valid events.
      """
      if periods is None:
          periods = PERIODS
      returns_dupe = returns.copy()
      returns_dupe.index = returns_dupe.index.map(pd.Timestamp)
      ranges = OrderedDict()
      for name, (start, end) in periods.items():
          try:
              period = returns_dupe.loc[start:end]
              if len(period) == 0:
                  continue
              ranges[name] = period
          except BaseException:
              continue
  
      return ranges
  
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 36 for calling a global function with example usage: extract_interesting_date_ranges(returns, periods) and returns: ranges