Convert string to unicode string

def to_unicode(obj, encoding='utf-8'):
    """ Convert string to unicode string """
    if isinstance(obj, string_types) or isinstance(obj, binary_type):
        if not isinstance(obj, text_type):
            obj = text_type(obj, encoding)
    return obj