code: def email_report(job, univ_options):
      
      fromadd = "results@protect.cgl.genomics.ucsc.edu"
      msg = MIMEMultipart()
      msg['From'] = fromadd
      if  univ_options['mail_to'] is None:
          return
      else:
          msg['To'] = univ_options['mail_to']
      msg['Subject'] = "Protect run for sample %s completed successfully." % univ_options['patient']
      body = "Protect run for sample %s completed successfully." % univ_options['patient']
      msg.attach(MIMEText(body, 'plain'))
      text = msg.as_string()
  
      try:
          server = smtplib.SMTP('localhost')
      except socket.error as e:
          if e.errno == 111:
              print('No mail utils on this maachine')
          else:
              print('Unexpected error while attempting to send an email.')
          print('Could not send email report')
      except:
          print('Could not send email report')
      else:
          server.sendmail(fromadd, msg['To'], text)
          server.quit()
docs: Send an email to the user when the run finishes.
  
      :param dict univ_options: Dict of universal options used by almost all tools