<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_cpu_state(self):
 """ Retrieves CPU state from client """

        state = c_int(0)
        self.library.Cli_GetPlcStatus(self.pointer,byref(state))
        
        try:
            status_string = cpu_statuses[state.value]
        except KeyError:
            status_string = None
        
        if not status_string:
            raise Snap7Exception("The cpu state (%s) is invalid" % state.value)
        
        logger.debug("CPU state is %s" % status_string)
        return status_string