return self __acct[:- '***def setacct(selfvalue)value value replace('-'''if len(value!self acctlenraise typeerror('invald acct number'elseself __acct value acct property(getacctsetacctdef remainget(self)return self retireage self age remain property(remaingetcould be methodnot attr unless already using as attr testing code the following codevalidate_tester pytests our classrun this script with the name of the class' module (sans py"as single command-line argument (you could also add most of its test code to the bottom of each fileor interactively import it from module after importing the classwe'll use this same testing code for all four versions of this example when it runsit makes two instances of our managed-attribute class and fetches and changes their various attributes operations expected to fail are wrapped in try statementsand identical behavior on is supported by enabling the print functionfile validate_tester py from __future__ import print_function def loadclass()import sysimportlib modulename sys argv[ module importlib import_module(modulenameprint('[using% ]module cardholderreturn module cardholder module name in command line import module by name string no need for getattr(here def printholder(who)print(who acctwho namewho agewho remainwho addrsep='if __name__ ='__main__'cardholder loadclass(bob cardholder(' - ''bob smith' ' main st'printholder(bobbob name 'bob smithbob age bob acct '- printholder(bobsue cardholder('''sue jones' ' main st'printholder(suetrysue age exceptprint('bad age for sue' managed attributes