def to_unicode(data, encoding=Constants.default_codec, errors=Constants.codec_error):
    """
    Converts given data to unicode string using package default settings, fighting **The Hell**!

    Usage::

        >>> to_unicode("myData")
        u'myData'
        >>> to_unicode("汉字/漢字")
        u'\u6c49\u5b57/\u6f22\u5b57'

    :param data: Data to convert.
    :type data: object
    :param encoding: File encoding codec.
    :type encoding: unicode
    :param errors: File encoding errors handling.
    :type errors: unicode
    :return: Unicode data.
    :rtype: unicode
    """

    if isinstance(data, type("")):
        return data
    else:
        try:
            return unicode(data, encoding, errors)
        except TypeError:
            return unicode(str(data), encoding, errors)
def to_unicode ( data , encoding = Constants . default_codec , errors = Constants . codec_error ) : if isinstance ( data , type ( "" ) ) : return data else : try : return unicode ( data , encoding , errors ) except TypeError : return unicode ( str ( data ) , encoding , errors )
Converts given data to unicode string using package default settings, fighting **The Hell**!

    Usage::

        >>> to_unicode("myData")
        u'myData'
        >>> to_unicode("汉字/漢字")
        u'\u6c49\u5b57/\u6f22\u5b57'

    :param data: Data to convert.
    :type data: object
    :param encoding: File encoding codec.
    :type encoding: unicode
    :param errors: File encoding errors handling.
    :type errors: unicode
    :return: Unicode data.
    :rtype: unicode