from typing import BinaryIO
import struct


def read_unicode_string(file: BinaryIO) -> str:
    """ Read a unicode string. All values defined as Unicode string consist of:
    A 4-byte length field, representing the number of UTF-16 code units in the string (not bytes).
    The string of Unicode values, two bytes per character, and a two byte null for the end of the string.
    """
    ustring_length = struct.unpack('>L', file.read(4))[0]
    bytes_length = ustring_length * 2
    ustring = struct.unpack(f'{bytes_length}s', file.read(bytes_length))[0]
    ustring = ustring.decode('utf-16-be')
    return ustring