def decode(value, encoding='utf-8'):
    """Decode given bytes value to unicode with given encoding

    :param bytes value: the value to decode
    :param str encoding: selected encoding
    :return: str; value decoded to unicode string if input is a bytes, original value otherwise

    >>> from pyams_utils.unicode import decode
    >>> decode(b'Cha\\xc3\\xaene accentu\\xc3\\xa9e')
    'Chaîne accentuée'
    >>> decode(b'Cha\\xeene accentu\\xe9e', 'latin1')
    'Chaîne accentuée'
    """
    return value.decode(encoding) if isinstance(value, bytes) else value