def METHOD_NAME(device, channel, range=None):
    """ Returns the analog input channel as specified for a given device
    """
    ai = device.find_subdevice_by_type(
        SUBDEVICE_TYPE.ai, factory=StreamingSubdevice
    ).channel(channel, factory=AnalogChannel, aref=AREF.diff)
    if range is not None:
        ai.range = ai.find_range(unit=UNIT.volt, min=range[0], max=range[1])
    return ai