Check against basestring instead of str in collect.hosts.

This makes it work with `hosts` string in `unicode`.