<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_aead(hsm, args, password):
 """ Generate an AEAD using the YubiHSM. """

    try:
        pw = password.ljust(args.min_len, chr(0x0))
        return hsm.generate_aead_simple(args.nonce.decode('hex'), args.key_handle, pw)
    except pyhsm.exception.YHSM_CommandFailed, e:
        if e.status_str == 'YHSM_FUNCTION_DISABLED':
            print "ERROR: The key handle %s is not permitted to YSM_AEAD_GENERATE." % (args.key_handle)
            return None
        else:
            print "ERROR: %s" % (e.reason)