<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_gain(self, gain=1):
 """ Set the gain """

        if gain == 1:
            self.i2c.write8(0x81, 0x02)
        else:
            self.i2c.write8(0x81, 0x12)

        time.sleep(self.pause)