def Input(self, m=None, t=None):  # pylint: disable=arguments-differ
    self.ResetState()

    # no input - step 0, producing step 1 input
    if m is None and t is None:
      cn = str(self.Nonce())
      self._AddOutput(cn)
      self._session.Set('cn', cn)

    # message input - step 1 output, produce step 2 input
    elif m is not None and t is None:

      class _Error(Exception):
        """Temporary exception used here."""

      cn = None

      try:
        # open up the message to get the client nonce (cn),
        # server nonce (sn) and signature (s)
        try:
          (cn, sn, s) = self._SplitMessage(m, 3)
        except MessageError, e:
          raise _Error('SplitMessage MessageError (%s)' % str(e))

        try:
          s = base64.urlsafe_b64decode(str(s))
        except TypeError, e:
          raise _Error('Invalid s parameter b64 format (%s)' % str(e))

        # verify cert is a server cert
        try:
          server_cert = self.LoadOtherCert(self._server_cert_pem)
        except ValueError, e:
          raise _Error('Server cert load error: %s' % str(e))
        if not self.VerifyCertSignedByCA(server_cert):
          raise _Error('Server cert is not signed by known CA')

        # load the Cn value that this client used previously
        orig_cn = self._session.Get('cn')
        if cn != orig_cn:
          raise _Error('Server supplied Cn does not match our Cn')

        # verify signature on message "Cn Sn"
        tmp_m = self._AssembleMessage(cn, sn)
        if not self.VerifyDataSignedWithCert(tmp_m, s, server_cert):
          raise _Error('Sn is not signed by server cert')

        # create return message: base64_client_cert cn sn
        c = base64.urlsafe_b64encode(self._cert_str)
        out_m = self._AssembleMessage(c, cn, sn)

        sig = self.Sign(out_m)
        sig = base64.urlsafe_b64encode(str(sig))

        #logging.debug('M= %s', out_m)
        #logging.debug('S= %s', sig)

        self._AddOutput({'m': out_m, 's': sig})

      except _Error, e:
        self._session.DeleteById('cn')
        self._AddError(str(e))
        self.AuthFail()

    # token input - step 3 input
    elif t is not None and m is None:
      if t == Auth1.TOKEN:
        self._session.DeleteById('cn')
        self.ResetState()
        self._auth_state = AuthState.OK
      else:
        self.AuthFail()

    # unknown input
    else:
      raise ValueError('Invalid input')
Tests that cancelling flows works.
dataset/ETHPy150Open google/simian/src/simian/auth/base.py/Auth1Client.Input--crossover with--dataset/ETHPy150Open google/grr/grr/gui/plugins/flow_management_test.py/TestFlowManagement.testCancelFlowWorksCorrectly