code: def change_state(self, state):
          
          if state is not self.state:
              if self.debug:
                  self.print_debug(b'state => ' + STATE_NAMES[state].encode())
              if self.state is STATE_NOT_STARTED:
                  self.read_in_state_not_started = b''
              self.state = state
docs: Change the state of the remote process, logging the change