IpAddressAdapter python 2.x fix

As of 2.5.1 the IpAddressAdapter stopped working in python 2.x.  Instead of writing the IP address bytes to the stream, it would write something similar to "<generator object <genexpr> at 0x1a38640>" to the stream, because of the way bytes works in python 2.x.

This change just checks whether bytes is str (as is done in the _decode function) and then avoids using the bytes builtin.  I also added some unit tests for the adapter