code: def get_results(self, stream, time_interval):
          
          query = stream.stream_id.as_raw()
          query['datetime'] = {'$gt': time_interval.start, '$lte': time_interval.end}
          with switch_db(StreamInstanceModel, 'hyperstream'):
              for instance in StreamInstanceModel.objects(__raw__=query):
                  yield StreamInstance(timestamp=instance.datetime, value=instance.value)
docs: Get the results for a given stream
  
          :param time_interval: The time interval
          :param stream: The stream object
          :return: A generator over stream instances