def utf8(array):
    """Preserves byte strings, converts Unicode into UTF-8.

    Args:
        array (bytearray or str) : input array of bytes or chars

    Returns:
        UTF-8 encoded bytearray
    """
    retval = None
    if isinstance(array, bytes) is True:
        # No need to convert in this case
        retval = array
    else:
        retval = array.encode("utf-8")
    return retval