def to_basestring(value):
    if value is None:
        return 'None'
    if isinstance(value, _BASESTRING_TYPES):
        return value
    elif isinstance(value, unicode_type):
        return value.decode("utf-8")
    else:
        return str(value)
Converts a string argument to a subclass of basestring.
dataset/ETHPy150Open limodou/uliweb/uliweb/core/template.py/to_basestring