<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def otp(ctx, access_code):
 """ Manage OTP Application. The YubiKey provides two keyboard-based slots which can each be configured with a credential. Several credential types are supported. A slot configuration may be write-protected with an access code. This prevents the configuration to be overwritten without the access code provided. Mode switching the YubiKey is not possible when a slot is configured with an access code. Examples: \b Swap the configurations between the two slots: $ ykman otp swap \b Program a random challenge-response credential to slot 2: $ ykman otp chalresp --generate 2 \b Program a Yubico OTP credential to slot 2, using the serial as public id: $ ykman otp yubiotp 1 --serial-public-id \b Program a random 38 characters long static password to slot 2: $ ykman otp static --generate 2 --length 38 """


    ctx.obj['controller'] = OtpController(ctx.obj['dev'].driver)
    if access_code is not None:
        if access_code == '':
            access_code = click.prompt(
                'Enter access code', show_default=False, err=True)

        try:
            access_code = parse_access_code_hex(access_code)
        except Exception as e:
            ctx.fail('Failed to parse access code: ' + str(e))

    ctx.obj['controller'].access_code = access_code