test on instance of `basestring` instead of str.