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

def ext_pillar(minion_id,
               pillar,
               api_url,
               email,
               secret_key,
               fqdn_separator=None,
               all_devices_regex=None,
               minion_regex=None):
    '''
    Query NSoT API for network devices
    '''
    ret = {}
    if minion_id == '*':
        log.info('There\'s no data to collect from NSoT for the Master')
        return ret

    if minion_regex:
        get_ext_pillar = _check_regex(minion_id, minion_regex)
        if get_ext_pillar:
            ret['nsot'] = _proxy_info(minion_id,
                                      api_url,
                                      email,
                                      secret_key,
                                      fqdn_separator)

    if all_devices_regex:
        get_ext_pillar = _check_regex(minion_id, all_devices_regex)
        if get_ext_pillar:
            if not ret.get('nsot'):
                ret['nsot'] = {}
            ret['nsot']['devices'] = _all_nsot_devices(api_url,
                                                       email,
                                                       secret_key)

    return ret