def METHOD_NAME(url, dest_dir, skip_first_sub_dir=False):
    """Download and extract an archive
    url:                URL to download
    dest_dir:           Destination directory
    skip_first_sub_dir: When this is set to true the first subdir in the zip file
                        will be skipped
    """
    tar_mode = None
    zip = False
    if url.lower().endswith(".tar.bz2"):
        tar_mode = "r:bz2"
    elif url.lower().endswith(".tar.xz"):
        tar_mode = "r:xz"
    elif url.lower().endswith(".tar.gz"):
        tar_mode = "r:gz"
    elif url.lower().endswith(".zip"):
        zip = True
    with tempfile.TemporaryFile() as file:
        length = download(url, file)
        file.seek(0)
        print(f"Downloaded {length} byte(s)")
        # Now when the file has been downloaded we start the extraction
        if tar_mode != None:
            extract_tar(file, tar_mode, dest_dir, skip_first_sub_dir)
        elif zip:
            extract_zip(file, dest_dir, skip_first_sub_dir)
        else:
            os.makedirs(dest_dir, exist_ok=True)
            dest_file_path = os.path.join(dest_dir, os.path.basename(url))
            with open(dest_file_path, 'wb') as dest_file:
                dest_file.write(file.read())