def METHOD_NAME(
    self,
    ctx: FlyteContext,
    lv: Literal,
    expected_python_type: Union[Type[LatchDir], PathLike],
) -> FlyteDirectory:
    uri = lv.scalar.blob.uri
    if expected_python_type is PathLike:
        raise TypeError(
            "Casting from Pathlike to LatchDir is currently not supported."
        )
    while get_origin(expected_python_type) == Annotated:
        expected_python_type = get_args(expected_python_type)[0]
    if not issubclass(expected_python_type, LatchDir):
        raise TypeError(
            f"Neither os.PathLike nor LatchDir specified {expected_python_type}"
        )
    # This is a local file path, like /usr/local/my_file, don't mess with it. Certainly, downloading it doesn't
    # make any sense.
    if not ctx.file_access.is_remote(uri):
        return expected_python_type(uri)
    # For the remote case, return an FlyteDirectory object that can download
    local_folder = ctx.file_access.get_random_local_directory()
    def _downloader():
        return ctx.file_access.get_data(uri, local_folder, is_multipart=True)
    ret = LatchDir(local_folder, uri, downloader=_downloader)
    ret._remote_source = uri
    return ret