Use open instead of file.
Use bytes literals instead of string literals.
Use six.moves.
Apply libmodernize.fixes.fix_dict.

(Exclude dulwich.objects)
Use six.binary_type, .byte2int, .indexbytes, and .iterbytes.