Format preferences

Add section headings to preferences file. Switch to PEP8-compliant 4
space tabs for Python files.