def construct_query(self)pass def do_query(self)pass def format_results(self)pass def output_results(self)pass def process_format(self)self connect(self construct_query(self do_query(self format_results(self output_results(the process_format method is the primary method to be called by an outside client it ensures each step is executed in orderbut it does not care if that step is implemented in this class or in subclass for our exampleswe know that three methods are going to be identical between our two classesimport sqlite class querytemplatedef connect(self)self conn sqlite connect("sales db"def construct_query(self)raise notimplementederror(def do_query(self)results self conn execute(self queryself results results fetchall(def format_results(self)output [for row in self resultsrow =[str(ifor in rowoutput append("join(row)self formatted_results "\njoin(outputdef output_results(self)raise notimplementederror(