visitor pattern def get_status(self)return random choice(['heating''cooling''on''off''error']def is_online(self)return self get_status(!'errorclass doorlock(object)def __init__(selfname)self name name def get_status(self)return random choice(range(- , )def is_online(self)return self get_status(!- class coffeemachine(object)def __init__(selfname)self name name def get_status(self)return random choice(range(- , )def is_online(self)return self get_status(!- class clock(object)def __init__(selfname)self name name def get_status(self)return "{}:{}format(random randrange( )random randrange( )def is_online(self)return true