code: def date_select(df, date_column, date, delta, max_date_column=None):
      
      delta = parse_delta(delta)
      if delta:
          start_date = date - delta
  
      if not max_date_column:
          df = df.query("%s < '%s'" % (date_column, date))
          if delta:
              df = df.query("%s >= '%s'" % (date_column, start_date))
      else:
          # event not entirely after
          df = df.query("not ({min} >= '{end}' and {max} >= '{end}')".format(
                            min=date_column, max=max_date_column, end=date))
          if delta:
              # event not entirely before
              df = df.query("not ({min} < '{start}' and {max} < '{start}')".format(
                            min=date_column, max=max_date_column, start=start_date))
  
      return df
docs: given a series an end date and number of days, return subset in the date range
      if delta is None then there is no starting date
      if max_date_column is specified then look for rows where the interval
          [date_column, max_date_column] intersects [date-delta, date+delta)