code: def mode_challenge_response(self, secret, type='HMAC', variable=True, require_button=False):
          
          if not type.upper() in ['HMAC', 'OTP']:
              raise yubico_exception.InputError('Invalid \'type\' (%s)' % type)
          if not self.capabilities.have_challenge_response(type.upper()):
              raise yubikey_base.YubiKeyVersionError('%s Challenge-Response not available in %s version %d.%d' \
                                                     % (type.upper(), self.capabilities.model, \
                                                            self.ykver[0], self.ykver[1]))
          self._change_mode('CHAL_RESP', major=2, minor=2)
          if type.upper() == 'HMAC':
              self.config_flag('CHAL_HMAC', True)
              self.config_flag('HMAC_LT64', variable)
              self._set_20_bytes_key(secret)
          else:
              # type is 'OTP', checked above
              self.config_flag('CHAL_YUBICO', True)
              self.aes_key(secret)
          self.config_flag('CHAL_BTN_TRIG', require_button)
docs: Set the YubiKey up for challenge-response operation.
  
          `type' can be 'HMAC' or 'OTP'.
  
          `variable' is only applicable to type 'HMAC'.
  
          For type HMAC, `secret' is expected to be 20 bytes (160 bits).
          For type OTP, `secret' is expected to be 16 bytes (128 bits).
  
          Requires YubiKey 2.2.