Fetches a sample and returns the integer value of the requested analog
        pin. output_type should be one of the following constants from
        xbee_helper.const:

        - ADC_RAW
        - ADC_PERCENTAGE
        - ADC_VOLTS
        - ADC_MILLIVOLTS

def read_analog_pin(
            self, pin_number, adc_max_volts,
            dest_addr_long=None, output_type=const.ADC_RAW):
        """
        Fetches a sample and returns the integer value of the requested analog
        pin. output_type should be one of the following constants from
        xbee_helper.const:

        - ADC_RAW
        - ADC_PERCENTAGE
        - ADC_VOLTS
        - ADC_MILLIVOLTS
        """
        sample = self.get_sample(dest_addr_long=dest_addr_long)
        try:
            return convert_adc(
                sample[const.ANALOG_PINS[pin_number]],
                output_type,
                adc_max_volts
            )
        except KeyError:
            raise exceptions.ZigBeePinNotConfigured(
                "Pin %s (%s) is not configured as an analog input." % (
                    pin_number, const.IO_PIN_COMMANDS[pin_number]))