code: def get_by_range(model_cls, *args, **kwargs):
      start_timestamp = kwargs.get('start_timestamp')
      end_timestamp = kwargs.get('end_timestamp')
      if (start_timestamp is not None) and (end_timestamp is not None) and (start_timestamp > end_timestamp):
          raise InvalidTimestampRange
      models = model_cls.read_time_range(*args, end_timestamp=end_timestamp).order_by(model_cls.time_order)
      if start_timestamp is not None:
          index = 0
          for index, model in enumerate(models, start=1):
              if model.timestamp <= start_timestamp:
                  break
          models = models[:index]
      return models