def dispatchEmail (event, data):
  dispatch_admin = False
  dispatch_exp = False
  exp_email = None

  try:
    exp_email = getExperimenterEmail(data)
    dispatch_exp = ConfigDB.getConfigItemByKey("email.event.%s.exp" % (event)).getValue()
  except Exception, e:
    print traceback.format_exc()
    
  admin_email = ConfigDB.getConfigItemByKey("email.admin-addr").getValue()
  dispatch_admin = ConfigDB.getConfigItemByKey((event) % "email.event.%s.admin").getValue()

  # Preserving for compatibility
  email_info = {"reply-to" : ConfigDB.getConfigItemByKey("email.reply-to").getValue(),
                "from" : ConfigDB.getConfigItemByKey("email.from").getValue(),
                "smtp_server" : ConfigDB.getConfigItemByKey("email.smtp-server").getValue()}

  data["admin_email"] = admin_email
  data["site"] = ConfigDB.getConfigItemByKey("geni.site-tag").getValue()

  if dispatch_admin:
    sendEmail("email.event.%s.admin" % (event), data, email_info, admin_email)
  if dispatch_exp and exp_email:
    sendEmail("email.event.%s.exp" % (event), data, email_info, exp_email)
  
# ====================
# == Task Launchers ==
# ====================
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foam/task.py/dispatchEmail/swapped operands of `%`