visitor pattern def get_status(self)return "{}:{}format(random randrange( )random randrange( )def is_online(self)return true def boot_up(self)self status " : def update_status(selfperson_ _homeperson_ _home)if person_ _homeif person_ _homepass else" : elif person_ _home" : elsepass as an exercisewrite tests for these states where person and person are either there or not make sure you cover all the possible options in these tests this is an already messy implementationand you know we are going to do some cleanup we could implement the system using state machinebut implementing state machine for each device for each state of the inhabitancy of the house just seems wrongit is also lot of work without lot of value there has to be better way to get us therelet' consider what we want to do the visitor pattern once againwe are going to tease apart complex piece of functionality into more discrete partsthen abstract these parts in such way that the one does not need to be intimately familiar with the other this pattern of separation and isolation is one you will see over and over again as you spend time optimizingextendingand cleaning up existing systems