def validate_otp(hsm, args):
try:<EOL><INDENT>res = pyhsm.yubikey.validate_otp(hsm, args.otp)<EOL>if args.verbose:<EOL><INDENT>print("<STR_LIT>" %(res.use_ctr, res.ts_low, res.ts_high, res.session_ctr))<EOL><DEDENT>return <NUM_LIT:0><EOL><DEDENT>except pyhsm.exception.YHSM_CommandFailed as e:<EOL><INDENT>if args.verbose:<EOL><INDENT>print("<STR_LIT:%s>" % (pyhsm.defines.status2str(e.status)))<EOL><DEDENT>for r in [pyhsm.defines.YSM_OTP_INVALID,pyhsm.defines.YSM_OTP_REPLAY,pyhsm.defines.YSM_ID_NOT_FOUND]:<EOL><INDENT>if e.status == r:<EOL><INDENT>return r - pyhsm.defines.YSM_RESPONSE<EOL><DEDENT><DEDENT>return <NUM_LIT><EOL><DEDENT>
Validate an OTP.