<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,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               config_file):
    '''
    Execute LDAP searches and return the aggregated data
    '''
    config_template = None
    try:
        config_template = _render_template(config_file)
    except jinja2.exceptions.TemplateNotFound:
        log.debug('pillar_ldap: missing configuration file %s', config_file)
    except Exception:
        log.debug('pillar_ldap: failed to render template for %s',
                  config_file, exc_info=True)

    if not config_template:
        # We don't have a config file
        return {}

    import salt.utils.yaml
    try:
        opts = salt.utils.yaml.safe_load(config_template) or {}
        opts['conf_file'] = config_file
    except Exception as err:
        import salt.log
        msg = 'pillar_ldap: error parsing configuration file: {0} - {1}'.format(
            config_file, err
        )
        if salt.log.is_console_configured():
            log.warning(msg)
        else:
            print(msg)
        return {}
    else:
        if not isinstance(opts, dict):
            log.warning(
                'pillar_ldap: %s is invalidly formatted, must be a YAML '
                'dictionary. See the documentation for more information.',
                config_file
            )
            return {}

    if 'search_order' not in opts:
        log.warning(
            'pillar_ldap: search_order missing from configuration. See the '
            'documentation for more information.'
        )
        return {}

    data = {}
    for source in opts['search_order']:
        config = opts[source]
        result = _do_search(config)
        log.debug('source %s got result %s', source, result)
        if result:
            data = _result_to_dict(data, result, config, source)
    return data