this code could be made wee bit more concise using set comprehensionwhich we'll discuss in the iterator pattern nowwith these building blockswe can trivially add method to our mailinglist class that sends messages to specific groupsdef send_mailing(selfsubjectmessagefrom_addr*groupsheaders=none)emails self emails_in_groups(*groupssend_email(subjectmessagefrom_addr*emailsheaders=headersthis function relies on variable argument lists as inputit takes list of groups as variable arguments it gets the list of -mails for the specified groups and passes those as variable arguments into send_emailalong with other arguments that were passed into this method the program can be tested by ensuring the smtp debugging server is running in one command promptandin second promptloading the code usingpython - mailing_list py create mailinglist object withm mailinglist(then create few fake -mail addresses and groupsalong the lines ofm add_to_group("friend @example com""friends" add_to_group("friend @example com""friends" add_to_group("family @example com""family" add_to_group("pro @example com""professional"finallyuse command like this to send -mails to specific groupsm send_mailing(" party""friends and family onlya party""me@example com""friends""family"headers={"reply-to""me @example com"} -mails to each of the addresses in the specified groups should show up in the console on the smtp server the mailing list works fine as it isbut it' kind of uselessas soon as we exit the programour database of information is lost let' modify it to add couple of methods to load and save the list of -mail groups from and to file