Don't use a bare except. This will mask any unrelated errors in the code, and indeed, if the above code hangs and you try to keyboard interrupt it, the keyboard interrupt will be caught by this except. Always catch the exception you are expecting.

In this case, though it's better to just check `hasattr(g, 'heurisch_diff')`.