khclean: use a temporary file when writing.
khclean: use a temporary file when writing.

This prevents data loss in cases where the script dies while writing to
the file.

Also perform PEP-8 compliance cleanups.

rahulg/dotfiles,rahulg/dotfiles