from typing import Union


def to_string(byte_array: Union[bytes, bytearray]) -> str:
    """
    convert a byte array into string

    :param byte_array: a latin1 encoded byte array
    :return: a decoded string
    """
    string = []
    for byte in byte_array:
        string.append(chr(byte))
    return "".join(string)