'Finds directive in the configuration.
Recursively searches through config files to find directives
Directives should be in the form of a case insensitive regex currently
.. todo:: arg should probably be a list
.. todo:: arg search currently only supports direct matching. It does
not handle the case of variables or quoted arguments. This should
be adapted to use a generic search for the directive and then do a
case-insensitive self.get_arg filter
Note: Augeas is inherently case sensitive while Apache is case
insensitive.  Augeas 1.0 allows case insensitive regexes like
regexp(/Listen/, "i"), however the version currently supported
by Ubuntu 0.10 does not.  Thus I have included my own case insensitive
transformation by calling case_i() on everything to maintain
compatibility.
:param str directive: Directive to look for
:param arg: Specific value directive must have, None if all should
be considered
:type arg: str or None
:param str start: Beginning Augeas path to begin looking
:param bool exclude: Whether or not to exclude directives based on
variables and enabled modules'

def find_dir(self, directive, arg=None, start=None, exclude=True):

    if (not start):
        start = get_aug_path(self.loc['root'])
    regex = ('(%s)|(%s)|(%s)' % (case_i(directive), case_i('Include'), case_i('IncludeOptional')))
    matches = self.aug.match(("%s//*[self::directive=~regexp('%s')]" % (start, regex)))
    if exclude:
        matches = self._exclude_dirs(matches)
    if (arg is None):
        arg_suffix = '/arg'
    else:
        arg_suffix = ("/*[self::arg=~regexp('%s')]" % case_i(arg))
    ordered_matches = []
    for match in matches:
        dir_ = self.aug.get(match).lower()
        if ((dir_ == 'include') or (dir_ == 'includeoptional')):
            ordered_matches.extend(self.find_dir(directive, arg, self._get_include_path(self.get_arg((match + '/arg'))), exclude))
        if (dir_ == directive.lower()):
            ordered_matches.extend(self.aug.match((match + arg_suffix)))
    return ordered_matches
