The following will work across 3 and 2 versions going back pretty far. It's necessary if you want to support pre-2.5 versions (where `as` was introduced):
Still kind of ugly, and not something which you want to litter than Django sources. Especially if you are going to put them all back when 2.4 support is dropped.
2.4 only supports this:
3.0 and up choke on this; they interpret it as "catch exceptions of type FooError or e and do not give the exception object a name".2.5 through 2.7 interpret like 2.4 but also support explicit parentheses to do what Python 3 does:
2to3 requires that you use the new exception syntax only, to avoid confusion.