docs: def _maybe_extract(compressed_filename, directory, extension=None):
      """ Extract a compressed file to ``directory``.
  
      Args:
          compressed_filename (str): Compressed file.
          directory (str): Extract to directory.
          extension (str, optional): Extension of the file; Otherwise, attempts to extract extension
              from the filename.
      """
      logger.info('Extracting {}'.format(compressed_filename))
  
      if extension is None:
          basename = os.path.basename(compressed_filename)
          extension = basename.split('.', 1)[1]
  
      if 'zip' in extension:
          with zipfile.ZipFile(compressed_filename, "r") as zip_:
              zip_.extractall(directory)
      elif 'tar' in extension or 'tgz' in extension:
          with tarfile.open(compressed_filename, mode='r') as tar:
              tar.extractall(path=directory)
  
      logger.info('Extracted {}'.format(compressed_filename))