code: def build_report(self, device_id, max_size=None, device_uptime=0, report_id=None, auth_chain=None):
          if self.walker is None or self.index is None:
              raise InternalError("You can only build a report with a DataStreamer if you create it with a SensorLog and a streamer index")
          if self.requires_signing() and auth_chain is None:
              raise ArgumentError("You must pass an auth chain to sign this report.")
          if self.requires_id() and report_id is None:
              raise ArgumentError("You must pass a report_id to serialize this report")
          if self.format == 'individual':
              reading = self.walker.pop()
              highest_id = reading.reading_id
              if self.report_type == 'telegram':
                  return StreamerReport(IndividualReadingReport.FromReadings(device_id, [reading]), 1, highest_id)
              elif self.report_type == 'broadcast':
                  return StreamerReport(BroadcastReport.FromReadings(device_id, [reading], device_uptime), 1, highest_id)
          elif self.format == 'hashedlist':
              max_readings = (max_size - 20 - 24) // 16
              if max_readings <= 0:
                  raise InternalError("max_size is too small to hold even a single reading", max_size=max_size)
              readings = []
              highest_id = 0
              try:
                  while len(readings) < max_readings:
                      reading = self.walker.pop()
                      readings.append(reading)
                      if reading.reading_id > highest_id:
                          highest_id = reading.reading_id
              except StreamEmptyError:
                  if len(readings) == 0:
                      raise
              return StreamerReport(SignedListReport.FromReadings(device_id, readings, report_id=report_id, selector=self.selector.encode(),
                                                                  streamer=self.index, sent_timestamp=device_uptime), len(readings), highest_id)
          raise InternalError("Streamer report format or type is not supported currently", report_format=self.format, report_type=self.report_type)