issue the query format the results into comma-delimited string output the data to file or -mail the query construction and output steps are different for the two tasksbut the remaining steps are identical we can use the template pattern to put the common steps in base classand the varying steps in two subclasses before we startlet' create database and put some sample data in itusing few lines of sqlimport sqlite conn sqlite connect("sales db"conn execute("create table sales (salesperson text"amt currencyyear integermodel textnew boolean)"conn execute("insert into sales values('tim' 'honda fit''true')"conn execute("insert into sales values('tim' 'ford focus''false')"conn execute("insert into sales values('gayle' 'dodge neon''false')"conn execute("insert into sales values('gayle' 'ford mustang''true')"conn execute("insert into sales values('gayle' 'lincoln navigator''true')"conn execute("insert into sales values('don' 'toyota prius''false')"conn commit(conn close(hopefully you can see what' going on here even if you don' know sqlwe've created table to hold the dataand used six insert statements to add sales records the data is stored in file named sales db now we have sample we can work with in developing our template pattern since we've already outlined the steps that the template has to performwe can start by defining the base class that contains the steps each step gets its own method (to make it easy to selectively override any one step)and we have one more managerial method that calls the steps in turn without any method contenthere' how it might lookclass querytemplatedef connect(self)pass