'Send email if session accepted or rejected'

def after_update_object(self, session, data, view_kwargs):

    if (('state' in data) and ((session.state == 'accepted') or (session.state == 'rejected'))):
        speakers = session.speakers
        for speaker in speakers:
            frontend_url = get_settings()['frontend_url']
            link = '{}/events/{}/sessions/{}'.format(frontend_url, session.event_id, session.id)
            send_email_session_accept_reject(speaker.email, session, link)
        if session.event.get_organizer():
            organizer_email = session.event.get_organizer().email
            frontend_url = get_settings()['frontend_url']
            link = '{}/events/{}/sessions/{}'.format(frontend_url, session.event_id, session.id)
            send_email_session_accept_reject(organizer_email, session, link)
