code: def matching_fpaths(dpath_list, include_patterns, exclude_dirs=[],
                      greater_exclude_dirs=[], exclude_patterns=[],
                      recursive=True):
      r
      if isinstance(dpath_list, six.string_types):
          dpath_list = [dpath_list]
      for dpath in dpath_list:
          for root, dname_list, fname_list in os.walk(dpath):
              # Look at all subdirs
              subdirs = pathsplit_full(relpath(root, dpath))
              # HACK:
              if any([dir_ in greater_exclude_dirs for dir_ in subdirs]):
                  continue
              # Look at one subdir
              if basename(root) in exclude_dirs:
                  continue
              _match = fnmatch.fnmatch
              for name in fname_list:
                  # yeild filepaths that are included
                  if any(_match(name, pat) for pat in include_patterns):
                      # ... and not excluded
                      if not any(_match(name, pat) for pat in exclude_patterns):
                          fpath = join(root, name)
                          yield fpath
              if not recursive:
                  break
docs: r"""
      walks dpath lists returning all directories that match the requested
      pattern.
  
      Args:
          dpath_list       (list):
          include_patterns (str):
          exclude_dirs     (None):
          recursive        (bool):
  
      References:
          # TODO: fix names and behavior of exclude_dirs and greater_exclude_dirs
          http://stackoverflow.com/questions/19859840/excluding-directories-in-os-walk
  
      Example:
          >>> # DISABLE_DOCTEST
          >>> from utool.util_path import *  # NOQA
          >>> import utool as ut
          >>> dpath_list = [dirname(dirname(ut.__file__))]
          >>> include_patterns = get_standard_include_patterns()
          >>> exclude_dirs = ['_page']
          >>> greater_exclude_dirs = get_standard_exclude_dnames()
          >>> recursive = True
          >>> fpath_gen = matching_fpaths(dpath_list, include_patterns, exclude_dirs,
          >>>                             greater_exclude_dirs, recursive)
          >>> result = list(fpath_gen)
          >>> print('\n'.join(result))