code: def get_cookbook_dirs(self, base_dir=None):
          
          if base_dir is None:
              base_dir = self.env_root
  
          cookbook_dirs = []
          dirs_to_skip = set(['.git'])
          for root, dirs, files in os.walk(base_dir):  # pylint: disable=W0612
              dirs[:] = [d for d in dirs if d not in dirs_to_skip]
              for name in files:
                  if name == 'metadata.rb':
                      if 'cookbook' in os.path.basename(os.path.dirname(root)):
                          cookbook_dirs.append(root)
          return cookbook_dirs
docs: Find cookbook directories.