Fix bytes regex for Python 3.

Closes gh-4602