unicode -> six.text_type where safe

This replaces every occurence of `unicode` with `six.text_type` where it is safe to do so for example in isinstance checks