defdownload_assets(asset_name:Union[VideoAssets,str])->str:""" Download a specified asset if it doesn't already exist or is corrupted. Parameters: asset_name (Union[VideoAssets, str]): The name or type of the asset to be downloaded. Returns: str: The filename of the downloaded asset. Example: ```python from supervision.assets import download_assets, VideoAssets download_assets(VideoAssets.VEHICLES) "vehicles.mp4" ``` """filename=asset_name.valueifisinstance(asset_name,VideoAssets)elseasset_nameifnotPath(filename).exists()andfilenameinVIDEO_ASSETS:print(f"Downloading {filename} assets \n")response=get(VIDEO_ASSETS[filename][0],stream=True,allow_redirects=True)response.raise_for_status()file_size=int(response.headers.get("Content-Length",0))folder_path=Path(filename).expanduser().resolve()folder_path.parent.mkdir(parents=True,exist_ok=True)withtqdm.wrapattr(response.raw,"read",total=file_size,desc="",colour="#a351fb")asraw_resp:withfolder_path.open("wb")asfile:copyfileobj(raw_resp,file)elifPath(filename).exists():ifnotis_md5_hash_matching(filename,VIDEO_ASSETS[filename][1]):print("File corrupted. Re-downloading... \n")os.remove(filename)returndownload_assets(filename)print(f"{filename} asset download complete. \n")else:valid_assets=", ".join(asset.valueforassetinVideoAssets)raiseValueError(f"Invalid asset. It should be one of the following: {valid_assets}.")returnfilename