def METHOD_NAME(self, channel, gain):
    """Set instrumentation amplifier gain of a channel.
    The four gain settings (0, 1, 2, 3) corresponds to gains of
    (1, 10, 100, 1000) respectively.
    :param channel: Channel index
    :param gain: Gain setting
    """
    gains = self.gains
    gains &= ~(0b11 << (channel*2))
    gains |= gain << (channel*2)
    self.bus.set_config_mu(SPI_CONFIG | spi.SPI_END,
                           16, self.div, SPI_CS_SR)
    self.bus.write(gains << 16)
    self.gains = gains