def read_rle(file_obj, header, bit_width, debug_logging):
    """Read a run-length encoded run from the given fo with the given header and bit_width.

    The count is determined from the header and the width is used to grab the
    value that's repeated. Yields the value repeated count times.
    """
    count = header >> 1
    zero_data = b"\x00\x00\x00\x00"
    width = (bit_width + 7) // 8
    data = file_obj.read(width)
    data = data + zero_data[len(data):]
    value = struct.unpack(b"<i", data)[0]
    if debug_logging:
        logger.debug("Read RLE group with value %s of byte-width %s and count %s",
                     value, width, count)
    for _ in range(count):
        yield value
Read a run-length encoded run from the given fo with the given header and bit_width.

    The count is determined from the header and the width is used to grab the
    value that's repeated. Yields the value repeated count times.