<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def configure(self, voltage_range=RANGE_32V, gain=GAIN_AUTO, bus_adc=ADC_12BIT, shunt_adc=ADC_12BIT):
 """ Configures and calibrates how the INA219 will take measurements. Arguments: voltage_range -- The full scale voltage range, this is either 16V or 32V represented by one of the following constants; RANGE_16V, RANGE_32V (default). gain -- The gain which controls the maximum range of the shunt voltage represented by one of the following constants; GAIN_1_40MV, GAIN_2_80MV, GAIN_4_160MV, GAIN_8_320MV, GAIN_AUTO (default). bus_adc -- The bus ADC resolution (9, 10, 11, or 12-bit) or set the number of samples used when averaging results represent by one of the following constants; ADC_9BIT, ADC_10BIT, ADC_11BIT, ADC_12BIT (default), ADC_2SAMP, ADC_4SAMP, ADC_8SAMP, ADC_16SAMP, ADC_32SAMP, ADC_64SAMP, ADC_128SAMP shunt_adc -- The shunt ADC resolution (9, 10, 11, or 12-bit) or set the number of samples used when averaging results represent by one of the following constants; ADC_9BIT, ADC_10BIT, ADC_11BIT, ADC_12BIT (default), ADC_2SAMP, ADC_4SAMP, ADC_8SAMP, ADC_16SAMP, ADC_32SAMP, ADC_64SAMP, ADC_128SAMP """

        self.__validate_voltage_range(voltage_range)
        self._voltage_range = voltage_range

        if self._max_expected_amps is not None:
            if gain == self.GAIN_AUTO:
                self._auto_gain_enabled = True
                self._gain = self._determine_gain(self._max_expected_amps)
            else:
                self._gain = gain
        else:
            if gain != self.GAIN_AUTO:
                self._gain = gain
            else:
                self._auto_gain_enabled = True
                self._gain = self.GAIN_1_40MV

        logging.info('gain set to %.2fV' % self.__GAIN_VOLTS[self._gain])

        logging.debug(
            self.__LOG_MSG_1 %
            (self._shunt_ohms, self.__BUS_RANGE[voltage_range],
             self.__GAIN_VOLTS[self._gain],
             self.__max_expected_amps_to_string(self._max_expected_amps),
             bus_adc, shunt_adc))

        self._calibrate(
            self.__BUS_RANGE[voltage_range], self.__GAIN_VOLTS[self._gain],
            self._max_expected_amps)
        self._configure(voltage_range, self._gain, bus_adc, shunt_adc)