def bytes_to_text(byte_array, encoding='UTF-8'):
    """
    Decode a byte array to a string following the given encoding.
    :param byte_array: Byte array to decode.
    :param encoding: String encoding (default UTF-8)
    :return: a decoded string
    """
    return bytes(byte_array).decode(encoding)