import struct


def _ReadCoverageInfoEntry(data_file):
  """Reads a packet of data from the specified file."""

  UINT32_SIZE = 4

  pkt_size_buf = data_file.read(UINT32_SIZE)
  if len(pkt_size_buf) != UINT32_SIZE:
    raise ValueError("Invalid packet size read.")

  pkt_size = struct.unpack("I", pkt_size_buf)[0]

  pkt = data_file.read(pkt_size)

  if len(pkt) != pkt_size:
    raise ValueError("Incomplete packet.")

  return pkt