def _invert(x: int, total_size: int) -> int:
    """Flips every bit of x as if x was an unsigned integer."""
    # use XOR of x and 0xFFFFFF to get the inverse
    return x ^ (2**total_size - 1)
Flips every bit of x as if x was an unsigned integer.
lightly/api/bitmask.py