code: def fetch(self, callback):
          session = self.client.sync.start(self.device_uuid)
          if session is None or 'id' not in session:
              return
          while True:
              queue_items = self.client.sync.fetch(self.device_uuid, session['id'])
              if not queue_items:
                  break
              ack_keys = []
              for item in queue_items:
                  if callback(item['meta'], item['data']):
                      ack_keys.append(item['meta']['sync']['ack_key'])
              if ack_keys:
                  self.client.sync.ack(self.device_uuid, ack_keys)