Some of the code still handles python2 bits, but this can all be dropped now that we don't support python2 anymore.