def send_next_event(email, event_name, link, up_coming_events):
 message_settings = MessageSettings.query.filter_by(action=NEXT_EVENT).first()
 if ((not message_settings) or (message_settings.mail_status == 1)):
  upcoming_event_html = '<ul>'
  for event in up_coming_events:
   upcoming_event_html += ("<a href='%s'><li> %s </li></a>" % (url_for('events.details_view', event_id=event.id, _external=True), event.name))
  upcoming_event_html += '</ul><br/>'
  send_email(to=email, action=NEXT_EVENT, subject=MAILS[NEXT_EVENT]['subject'].format(event_name=event_name), html=MAILS[NEXT_EVENT]['message'].format(email=str(email), event_name=str(event_name), link=link, up_coming_events=upcoming_event_html))

def send_next_event ( email , event_name , link , up_coming_events ) : message_settings = MessageSettings . query . filter_by ( action = NEXT_EVENT ) . first ( ) if ( ( not message_settings ) or ( message_settings . mail_status == 1 ) ) : upcoming_event_html = '<ul>' for event in up_coming_events : upcoming_event_html += ( "<a href='%s'><li> %s </li></a>" % ( url_for ( 'events.details_view' , event_id = event . id , _external = True ) , event . name ) ) upcoming_event_html += '</ul><br/>' send_email ( to = email , action = NEXT_EVENT , subject = MAILS [ NEXT_EVENT ] [ 'subject' ] . format ( event_name = event_name ) , html = MAILS [ NEXT_EVENT ] [ 'message' ] . format ( email = str ( email ) , event_name = str ( event_name ) , link = link , up_coming_events = upcoming_event_html ) )
send next event .