Fix py3k build

By using six.string_types instead of basestring builting.  Improve Twisted
compatibility, similarly