def to_unicode(text):
    """Convert to unicode."""
    if isinstance(text, unicode):
        return text
    if isinstance(text, six.string_types):
        return decode_to_unicode(text)
    return unicode(text)