replaced `basestring` as `str`