Clean up various style issues.

Mostly focusing on manager.py.
- PEP8 style issues, though not all
- some comments on obscure code pieces
- some loops rewritten as list comprehensions
- more robust handling of `_unique` using a context manager
- hiding of `FieldTranslator` internals for better encapsulation (it no longer inherits `dict`, it has a `_cache` attribute instead).
- moving some method around so they are grouped by type (database query / queryset change / internals)