PY3: use six.iterkeys, six.iteritems, and tempfile

This one is less trivial.

I was looking to change Headers.iteritems too, but that one seems different in behavior, so I left alone everything related to that.
I think it is better to either use context manager to close this file explicitly, or to use `os.devnull`.