def build_lines_data(lines) -> bytes:
    """
    Builds the byte string from given lines to send to the server
    :param lines:
    :return bytes:
    """
    result = []
    for line in lines:
        result.append(f"{(len(line) + 5 ):04x}".encode())
        result.append(line)
        result.append(b"\n")
    result.append(b"0000")
    return b''.join(result)