These changes do not affect behavior.
Don't unnecessarily initialize an empty bytes object before appending to it.
Don't use an intermediate variable before returning in trivial cases.
Add a few typehints when they are not obvious to the reader (e.g. when *string* actually means *bytes* because of python2 legacy)