Capgemini Engineering firmware commonly updates individual control flags in memory-mapped hardware registers. Implement a function that performs the equivalent of set, clear, and toggle macros for one selected bit without changing any other bit.
The bit position is zero-based, so bit 0 is the least significant bit.
Implement modify_bit(register_value, bit_index, operation):
register_value is an unsigned 32-bit integer.bit_index is an integer from 0 through 31.operation is one of the strings "set", "clear", or "toggle".For set, the selected bit becomes 1. For clear, it becomes 0. For toggle, its value is inverted. All non-selected bits must remain unchanged.
def modify_bit(register_value, bit_index, operation):