def _get_nonzero_bits(x: int) -> List[int]:
    """Returns a list of indices of nonzero bits in x."""
    offset = 0
    nonzero_bit_indices = []
    while x > 0:
        # if the number is odd, there is a nonzero bit at offset
        if x % 2 > 0:
            nonzero_bit_indices.append(offset)
        # increment the offset and divide the number x by two (rounding down)
        offset += 1
        x = x // 2
    return nonzero_bit_indices
Returns a list of indices of nonzero bits in x.
lightly/api/bitmask.py