checking for basestring makes more flexible

In Python2 it's sadly possible to have a string which is not of exactly type `str()`, e.g., unicode strings. For the isinstance checks it doesn't matter which type of string it is, as long as it is one kind of them. To check for all kinds of strings, it is better to check for `basestring`, because that works for all string types.