def get_time(bytearray_: bytearray, byte_index: int) -> str:
    """Get time value from bytearray.

        Notes:
            Datatype `time` consists in 4 bytes in the PLC.
            Maximum possible value is T#24D_20H_31M_23S_647MS(2147483647).
            Lower posible value is T#-24D_20H_31M_23S_648MS(-2147483648).

        Args:
            bytearray_: buffer to read.
            byte_index: byte index from where to start reading.

        Returns:
            Value read.

        Examples:
            >>> import struct
            >>> data = bytearray(4)
            >>> data[:] = struct.pack(">i", 2147483647)
            >>> snap7.util.get_time(data, 0)
                '24:20:31:23:647'
        """
    data_bytearray = bytearray_[byte_index:byte_index + 4]
    bits = 32
    sign = 1
    byte_str = data_bytearray.hex()
    val = int(byte_str, 16)
    if (val & (1 << (bits - 1))) != 0:
        sign = -1  # if sign bit is set e.g., 8bit: 128-255
        val = val - (1 << bits)  # compute negative value
        val = val * sign

    milli_seconds = val % 1000
    seconds = val // 1000
    minutes = seconds // 60
    hours = minutes // 60
    days = hours // 24

    time_str = f"{days * sign!s}:{hours % 24!s}:{minutes % 60}:{seconds % 60!s}.{milli_seconds!s}"

    return time_str