host="localhost"port= **headers)email mimetext(messageemail['subject'subject email['from'from_addr for headervalue in headers items()email[headervalue sender smtplib smtp(hostportfor addr in to_addrsdel email['to'email['to'addr sender sendmail(from_addraddremail as_string()sender quit(we won' cover the code inside this method too thoroughlythe documentation in the standard library can give you all the information you need to use the smtplib and email modules effectively we've used both variable argument and keyword argument syntax in the function call the variable argument list allows us to supply single string in the default case of having single to addressas well as permitting multiple addresses to be supplied if required any extra keyword arguments are mapped to -mail headers this is an exciting use of variable arguments and keyword argumentsbut it' not really great interface for the person calling the function in factit makes many things the programmer will want to do impossible the headers passed into the function represent auxiliary headers that can be attached to method such headers might include reply-toreturn-pathor -pretty-much-anything but in order to be valid identifier in pythona name cannot include the character in generalthat character represents subtraction soit' not possible to call function with reply-to my@email com it appears we were too eager to use keyword arguments because they are new tool we just learned about in this we'll have to change the argument to normal dictionarythis will work because any string can be used as key in dictionary by defaultwe' want this dictionary to be emptybut we can' make the default parameter an empty dictionary sowe'll have to make the default argument noneand then set up the dictionary at the beginning of the methoddef send_email(subjectmessagefrom_addr*to_addrs