<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def targets(tgt, tgt_type='range', **kwargs):
    '''
    Return the targets from a range query
    '''

    r = seco.range.Range(__opts__['range_server'])
    log.debug('Range connection to \'%s\' established', __opts__['range_server'])

    hosts = []
    try:
        log.debug('Querying range for \'%s\'', tgt)
        hosts = r.expand(tgt)
    except seco.range.RangeException as err:
        log.error('Range server exception: %s', err)
        return {}
    log.debug('Range responded with: \'%s\'', hosts)

    # Currently we only support giving a raw range entry, no target filtering supported other than what range returns :S
    tgt_func = {
        'range': target_range,
        'glob': target_range,
        # 'glob': target_glob,
    }

    log.debug('Filtering using tgt_type: \'%s\'', tgt_type)
    try:
        targeted_hosts = tgt_func[tgt_type](tgt, hosts)
    except KeyError:
        raise NotImplementedError
    log.debug('Targeting data for salt-ssh: \'%s\'', targeted_hosts)

    return targeted_hosts