<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def archive_handler(unused_build_context, target, fetch, package_dir, tar):
 """Handle remote downloadable archive URI. Download the archive and cache it under the private builer workspace (unless already downloaded), extract it, and add the content to the package tar. TODO(itamar):
 Support re-downloading if remote changed compared to local. TODO(itamar):
 Support more archive formats (currently only tarballs). """

    package_dest = join(package_dir, basename(urlparse(fetch.uri).path))
    package_content_dir = join(package_dir, 'content')
    extract_dir = (join(package_content_dir, fetch.name)
                   if fetch.name else package_content_dir)
    fetch_url(fetch.uri, package_dest, package_dir)

    # TODO(itamar): Avoid repetition of splitting extension here and above
    # TODO(itamar): Don't use `extractall` on potentially untrsuted archives
    ext = splitext(package_dest)[-1].lower()
    if ext in ('.gz', '.bz2', '.tgz'):
        with tarfile.open(package_dest, 'r:*') as src_tar:
            src_tar.extractall(extract_dir)
    elif ext in ('.zip',):
        with ZipFile(package_dest, 'r') as zipf:
            zipf.extractall(extract_dir)
    else:
        raise ValueError('Unsupported extension {}'.format(ext))
    tar.add(package_content_dir, arcname=split_name(target.name))