move _parse_header to module level
in py3 we use straight email.message_from_string
rewrite regression test
py3 division returns floats; cast back to int
fix some string/bytes issues in catalog