def bitmap_is_set(bitmap: bytes, i: int) -> bool:
    """Returns True if bitmap is set at the i'th bit."""
    assert (i >> 3) < len(bitmap), f"{i} out of range ({len(bitmap)})"
    return bool(bitmap[i >> 3] & (0x80 >> (i & 7)))