'Processes this event.'

@flow.EventHandler(allow_client_access=True)
def ProcessMessage(self, message=None, event=None):

    _ = event
    nanny_msg = ''
    crash_details = message.payload
    client_id = crash_details.client_id
    session_id = crash_details.session_id
    flow_obj = aff4.FACTORY.Open(session_id, token=self.token)
    logging.info('Client    crash    reported,    client    %s.', client_id)
    if flow_obj.handles_crashes:
        return
    stats.STATS.IncrementCounter('grr_client_crashes')
    client = aff4.FACTORY.Open(client_id, token=self.token)
    client_info = client.Get(client.Schema.CLIENT_INFO)
    crash_details.client_info = client_info
    crash_details.crash_type = self.well_known_session_id
    self.WriteAllCrashDetails(client_id, crash_details, flow_session_id=session_id)
    to_send = []
    try:
        hunt_session_id = self._ExtractHuntId(session_id)
        if (hunt_session_id and (hunt_session_id != session_id)):
            hunt_obj = aff4.FACTORY.Open(hunt_session_id, aff4_type=implementation.GRRHunt, token=self.token)
            email = hunt_obj.runner_args.crash_alert_email
            if email:
                to_send.append(email)
    except aff4.InstantiationError:
        logging.error('Failed    to    open    hunt    %s.', hunt_session_id)
    email = config.CONFIG['Monitoring.alert_email']
    if email:
        to_send.append(email)
    for email_address in to_send:
        if crash_details.nanny_status:
            nanny_msg = ('Nanny    status:    %s' % crash_details.nanny_status)
        client = aff4.FACTORY.Open(client_id, token=self.token)
        hostname = client.Get(client.Schema.HOSTNAME)
        url = urllib.urlencode((('c', client_id), ('main', 'HostInformation')))
        context_html = self.ConvertRDFValueToHTML(flow_obj.context)
        state_html = self.ConvertRDFValueToHTML(flow_obj.state)
        args_html = self.ConvertRDFValueToHTML(flow_obj.args)
        runner_args_html = self.ConvertRDFValueToHTML(flow_obj.runner_args)
        email_alerts.EMAIL_ALERTER.SendEmail(email_address, 'GRR    server', ('Client    %s    reported    a    crash.' % client_id), (self.mail_template % dict(client_id=client_id, admin_ui=config.CONFIG['AdminUI.url'], hostname=hostname, context=context_html, state=state_html, args=args_html, runner_args=runner_args_html, urn=url, nanny_msg=nanny_msg, signature=config.CONFIG['Email.signature'])), is_html=True)
    if nanny_msg:
        msg = ('Client    crashed,    ' + nanny_msg)
    else:
        msg = 'Client    crashed.'
    flow.GRRFlow.TerminateFlow(session_id, reason=msg, token=self.token, force=True)
