<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_aes_mode(mode):
 """Return pycrypto's AES mode, raise exception if not supported"""

    aes_mode_attr = "MODE_{}".format(mode.upper())
    try:
        aes_mode = getattr(AES, aes_mode_attr)
    except AttributeError:
        raise Exception(
            "Pycrypto/pycryptodome does not seem to support {}. ".format(aes_mode_attr) +
            "If you use pycrypto, you need a version >= 2.7a1 (or a special branch)."
        )
    return aes_mode