code: def extract(path, timeout=None, extract_dir=None, content_type=None):
      
      content_type = content_type or content_type_from_file(path)
      if content_type == "application/zip":
          extractor = ZipExtractor(timeout=timeout)
      else:
          extractor = TarExtractor(timeout=timeout)
  
      try:
          ctx = extractor.from_path(path, extract_dir=extract_dir, content_type=content_type)
          content_type = extractor.content_type
          yield Extraction(ctx.tmp_dir, content_type)
      finally:
          if extractor.created_tmp_dir:
              fs.remove(extractor.tmp_dir, chmod=True)
docs: Extract path into a temporary directory in `extract_dir`.
  
      Yields an object containing the temporary path and the content type of the
      original archive.
  
      If the extraction takes longer than `timeout` seconds, the temporary path
      is removed, and an exception is raised.