from ansible.module_utils.pycompat24 import get_exception def do_stuff(): get_exception()