def changeBitInInteger(integer, bitPosition, bitValue):
    """Modifies a provided integer by either setting or clearing a specified bit.
    
    integer -- the number in which to modify a bit
    bitPosition -- the position of the bit in the integer, starting with the LSB = 0
    bitValue -- the value to which the bit should be changed, either True or False
    
    returns the modified integer.
    """
    shiftedBitValue = 1<<bitPosition
    if bitValue:
        return (integer | shiftedBitValue)
    else:
        return (integer & ~shiftedBitValue)