def __init__(self)self __lamp light(self __switchup flipupcommand(self __lampself __switchdown flipdowncommand(self __lampself __switch switch(self __switchup,self __switchdowndef switch(self,cmd)cmd cmd strip(upper(tryif cmd ="on"self __switch flipup(elif cmd ="off"self __switch flipdown(elseprint "argument \"on\or \"off\is required except exceptionmsgprint "exception occured%smsg execute if this file is run as script and not imported as module if __name__ ="__main__"lightswitch lightswitch(print "switch on test lightswitch switch("on"print "switch off testlightswitch switch("off"print "invalid command testlightswitch switch("****" www testingperspective com