code: def handle_alarm(sender, **kwargs):
      
      zone = kwargs.pop('zone', None)
      text = "Alarm: Zone {0}".format(zone)
  
      # Build the email message
      msg = MIMEText(text)
      msg['Subject'] = SUBJECT
      msg['From'] = FROM_ADDRESS
      msg['To'] = TO_ADDRESS
  
      s = smtplib.SMTP(SMTP_SERVER)
  
      # Authenticate if needed
      if SMTP_USERNAME is not None:
          s.login(SMTP_USERNAME, SMTP_PASSWORD)
  
      # Send the email
      s.sendmail(FROM_ADDRESS, TO_ADDRESS, msg.as_string())
      s.quit()
  
      print('sent alarm email:', text)
docs: Handles alarm events from the AlarmDecoder.