following / filestreams pydemonstrates one way to code the classclass processordef __init__(selfreaderwriter)self reader reader self writer writer def process(self)while truedata self reader readline(if not databreak data self converter(dataself writer write(datadef converter(selfdata)assert false'converter must be definedor raise exception this class defines converter method that it expects subclasses to fill init' an example of the abstract superclass model we outlined in (more on assert in part vii-it simply raises an exception if its test is falsecoded this wayreader and writer objects are embedded within the class instance (composition)and we supply the conversion logic in subclass rather than passing in converter function (inheritancethe file converters py shows howfrom streams import processor class uppercase(processor)def converter(selfdata)return data upper(if __name__ ='__main__'import sys obj uppercase(open('trispam txt')sys stdoutobj process(herethe uppercase class inherits the stream-processing loop logic (and anything else that may be coded in its superclassesit needs to define only what is unique about it --the data conversion logic when this file is runit makes and runs an instance that reads from the file trispam txt and writes the uppercase equivalent of that file to the stdout streamc:\codetype trispam txt spam spam spamc:\codepython converters py spam spam spamoop and composition"has-arelationships