'Get notifications for user'

def get_notifications(self):

    notifications = frappe.desk.notifications.get_notifications()
    notifications = sorted(notifications.get(u'open_count_doctype', {}).items(), (lambda a, b: (1 if (a[1] < b[1]) else (-1))))
    notifications = [{u'key': n[0], u'value': n[1], u'link': get_url_to_list(n[0])} for n in notifications if n[1]]
    return notifications
