adapter pattern import csv import smtplib from email mime text import mimetext class mailer(object)def send(senderrecipientssubjectmessage)msg mimetext(messagemsg['subject'subject msg['from'sender msg['to'[recipientss smtplib smtp('localhost' send_message(recipients quit(class logger(object)def output(message)print("[logger]format(message)class loggeradapter(object)def __init__(selfwhat_i_have)self what_i_have what_i_have def send(senderrecipientssubjectmessage)log_message "from{}\nto{}\nsubject{}\nmessage{}formatsenderrecipientssubjectmessage self what_i_have output(log_messagedef __getattr__(selfattr)return getattr(self what_i_haveattrif __name__ ="__main__"user_fetcher userfetcher('users csv'mailer mailer(mailer send'me@example com'