replace basetring with str for python 3