code: def get_bounds(self, start=None, end=None):
          
  
          bounds = {}
          if start or end:
              # Extend bounds so we have data until start and end
              start_ts = None
              end_ts = None
  
              if start:
                  start = start.replace(microsecond=0)
                  start_ts = start.replace(tzinfo=timezone.utc).timestamp()
                  start_ts_ms = start_ts * 1000  # ES uses ms
              if end:
                  end = end.replace(microsecond=0)
                  end_ts = end.replace(tzinfo=timezone.utc).timestamp()
                  end_ts_ms = end_ts * 1000  # ES uses ms
  
              bounds_data = {}
              if start:
                  bounds_data["min"] = start_ts_ms
              if end:
                  bounds_data["max"] = end_ts_ms
  
              bounds["extended_bounds"] = bounds_data
          return bounds
docs: Get bounds for the date_histogram method
  
          :param start: start date to set the extended_bounds min field
          :param end: end date to set the extended_bounds max field
          :returns bounds: a dictionary containing the min and max fields
                           required to set the bounds in date_histogram aggregation