use basestring instead of types.StringType

basestring is more robust and compatible with python 3, given unicode