PEP8 fixes.
Avoid DoesNotExist exception after switching to another language.

Changed regex for removing unit parameter from URL. It can be
after # or &.