[Python-ideas] Avoiding nested for try..finally: atexit for functions?