'Send a notification to the user in the UI.
Args:
message_type: One of aff4_grr.Notification.notification_types e.g.
"ViewObject", "HostInformation", "GrantAccess".
subject: The subject to use, normally a URN.
msg: The message to display.
source: The class doing the notification.
Raises:
TypeError: On invalid message_type.'

def Notify(self, message_type, subject, msg, source):

    pending = self.Get(self.Schema.PENDING_NOTIFICATIONS)
    if (pending is None):
        pending = self.Schema.PENDING_NOTIFICATIONS()
    if (message_type not in rdf_flows.Notification.notification_types):
        raise TypeError(('Invalid    notification    type    %s' % message_type))
    pending.Append(type=message_type, subject=subject, message=msg, source=source, timestamp=long((time.time() * 1000000.0)))
    while (len(pending) > 50):
        pending.Pop(0)
    self.Set(self.Schema.PENDING_NOTIFICATIONS, pending)
