Make astropy.io.registry and astropy.io.misc compatible with Python 2 and 3 using six

After #1907, this was a nice PR to work on ;)

@taldcroft - this makes all of ``astropy.io`` 2/3-compatible!

c.f. #2033