Check if last command succeeded by checking buffer

def check_success(self, device_id, sent_cmd1, sent_cmd2):
        """Check if last command succeeded by checking buffer"""
        device_id = device_id.upper()

        self.logger.info('check_success: for device %s cmd1 %s cmd2 %s',
                         device_id, sent_cmd1, sent_cmd2)

        sleep(2)
        status = self.get_buffer_status(device_id)
        check_id = status.get('id_from', '')
        cmd1 = status.get('cmd1', '')
        cmd2 = status.get('cmd2', '')
        if (check_id == device_id) and (cmd1 == sent_cmd1) and (cmd2 == sent_cmd2):
            self.logger.info("check_success: Response device %s cmd %s cmd2 %s SUCCESS",
                             check_id, cmd1, cmd2)
            return True

        self.logger.info("check_success: No valid response found for device %s cmd %s cmd2 %s",
                         device_id, sent_cmd1, sent_cmd2)
        return False