def extract_bits(data, shift, length):
    bitmask = ((1 << length) - 1) << shift
    return ((data & bitmask) >> shift)

# ==================================================
Convert the array of vertices for a hemisphere to MNI coordinates
dataset/ETHPy150Open SawdustSoftware/simpleflake/simpleflake/simpleflake.py/extract_bits--crossover with--dataset/ETHPy150Open mne-tools/mne-python/mne/source_space.py/vertex_to_mni