[docs]deffetch_latest(project:str,asset:str,registry:str,url:str,force_remote:bool=False)->Optional[str]:""" Fetch the latest version of an asset of a project. Args: project: Name of a project. asset: Name of an asset in the ``project``. registry: Path to the Gobbler registry. url: URL of the REST API. Only used for remote queries. force_remote: Whether to force a remote query via ``url``, even if the ``registry`` is present on the current filesystem. Returns: The name of the latest version of the ``asset``, or None if no latest version exists. """ifos.path.exists(registry)andnotforce_remote:proposed=os.path.join(registry,project,asset,"..latest")ifnotos.path.exists(proposed):returnNonewithopen(proposed,"r")ashandle:vers=json.load(handle)returnvers["version"]res=requests.get(url+"/fetch/"+project+"/"+asset+"/..latest")ifres.status_code==404:returnNoneelifres.status_code>=300:raiseut.format_error(res)body=res.json()returnbody["version"]