def status_notifciation(changed_status):
    notifications = {}
    for category, services in changed_status.iteritems():
        for name, st in services.iteritems():
            # just push notification about game server now
            if name == "GameServer":
                notifications[category] = st

    for category, st in notifications.iteritems():
        status = "Available" if st else "Unavailable"

        offset = 0
        limit = 200
        while True:
            subscribers = load_model("subscribers").get_subscribers(limit, offset)
            if not subscribers:
                break

            for subscribe in subscribers:
                if category in subscribe.categorys:
                    alert = _trans_alert("Diablo3 %s server status has changed to %s",
                                         category, status, subscribe.locale)
                    apns_tasks.apns_push_task.delay(subscribe.token, {},
                                                    alert=alert, badge=1,
                                                    sound="default")
            offset += len(subscribers)
dataset/ETHPy150Open felinx/d3status/d3status/tasks/status_tasks.py/status_notifciation/original