only convert input bytes if they are a string and we are in python 3

in python 2 'str' and 'bytes' are the same. if input bytes are not
a string or bytes, then raise a TypeError.