<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def search_for_oath_code(hsm, key_handle, nonce, aead, user_code, interval=30, tolerance=0):
 """ Try to validate an OATH TOTP OTP generated by a token whose secret key is available to the YubiHSM through the AEAD. The parameter `aead' is either a string, or an instance of YHSM_GeneratedAEAD. Returns timecounter value on successful auth, and None otherwise. """


    # timecounter is the lowest acceptable value based on tolerance
    timecounter = timecode(datetime.datetime.now(), interval) - tolerance

    return search_hotp(
        hsm, key_handle, nonce, aead, timecounter, user_code, 1 + 2*tolerance)