code: def get_directories_re(
              self,
              directory_re,
              full_path=False,
              ignorecase=False):
          
          if ignorecase:
              compiled_re = re.compile(directory_re, re.I)
          else:
              compiled_re = re.compile(directory_re)
  
          found = set()
  
          if self.handle:
              for member in self.handle.getmembers():
                  # zipfiles only list directories => have to work around that
                  if isinstance(member, ZipInfo):
                      to_match = os.path.dirname(member.name)
                  # tarfiles => only match directories
                  elif isinstance(member, TarInfo) and member.isdir():
                      to_match = member.name
                  else:
                      to_match = None
                  if to_match:
                      if ((full_path and compiled_re.search(to_match)) or (
                              not full_path and compiled_re.search(
                                  os.path.basename(to_match)))):
                          found.add(to_match)
  
          return list(found)
docs: Same as get_files_re, but for directories