import six


def to_unicode(s, encoding='utf-8'):
    """Convert the string s to unicode if it is of type bytes.

    Returns:
        Unicode string
    """
    if isinstance(s, six.text_type):
        return s
    elif isinstance(s, bytes):
        return s.decode(encoding)
    return s