@classmethod
  def _HandleBadPushToken(cls, client, push_token, timestamp=None, callback=None):
    def _OnQueryByPushToken(devices):
      if not devices:
        logging.warning('unable to locate device for push token: %s' % push_token)
        return
      for device in devices:
        if device.last_access is None or device.last_access < timestamp:
          logging.info('unsetting push_token for device %s' % device)
          device.push_token = None
          device.Update(client, callback if callback else util.NoCallback)

    query_expr = ('device.push_token={t}', {'t': push_token})
    Device.IndexQuery(client, query_expr, None, _OnQueryByPushToken)
Callback in the event of failed delivery of push notification.
dataset/ETHPy150Open viewfinderco/viewfinder/backend/db/device.py/Device._HandleBadPushToken