<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_mail(to_addr, subj_msg, body_msg, attach_path, serv_addr, serv_port, from_addr, passwd):
 """Send an e-mail message using smtplib and email standard python libraries. IMPORTANT! Password is stored as plain text! Do NOT use with your personal account! Args: to_addr (str):
 Recipient address. subj_msg (str):
 Message subject. body_msg (str):
 Message body. serv_addr (str):
 Server's address. Default: <smtp.gmail.com>. serv_port (int):
 Server's port. Default: <587>. from_addr (str):
 Account address. Default: <headnode.notifiy@gmail.com>. passwd (str):
 Account password. """

    msg = MIMEMultipart()
    if attach_path is not None:
        with open(attach_path, "rb") as fin:
            part = MIMEBase("application", "octet-stream")
            part.set_payload(fin.read())
            encoders.encode_base64(part)
            part.add_header("Content-Disposition",
                            "attachment; filename={0}".format(attach_path))
            msg.attach(part)
    else:
        pass
    msg["From"] = from_addr
    msg["To"] = to_addr
    msg["Subject"] = subj_msg
    msg.attach(MIMEText(body_msg, "plain"))
    server = smtplib.SMTP(serv_addr, serv_port)
    server.starttls()
    server.login(from_addr, passwd)
    text_msg = msg.as_string()
    server.sendmail(from_addr, to_addr, text_msg)
    server.quit