def METHOD_NAME(self, var_name: str, value: t.Any, image: bool) -> t.Union[str, t.Tuple[str], t.Any]:  # noqa: C901
    if value is None:
        return ""
    newvalue = value
    mime = None
    if not isinstance(newvalue, (str, pathlib.Path)) and (
        getsizeof(newvalue) > self.__data_url_max_size or not _has_magic_module
    ):
        # write data to file
        file_name = "TaiPyContent.bin"
        if _has_magic_module:
            try:
                mime = magic.from_buffer(value, mime=True)
                file_name = "TaiPyContent." + mime.split("/")[-1]
            except Exception as e:
                _warn(f"{self.__get_display_name(var_name)} ({type(value)}) cannot be typed:\n{e}")
        file_path = _get_non_existent_file_path(self.__temp_dir_path, file_name)
        try:
            with open(file_path, "wb") as temp_file:
                temp_file.write(value)
        except Exception as e:
            _warn(
                f"{self.__get_display_name(var_name)} ({type(value)}) cannot be written to file {file_path}:\n{e}"
            )
        newvalue = file_path
    if isinstance(newvalue, (str, pathlib.Path)):
        path = pathlib.Path(newvalue) if isinstance(newvalue, str) else newvalue
        if not path.is_file():
            if (
                var_name != "Gui.download"
                and not str(path).startswith("http")
                and not str(path).startswith("/")
                and not str(path).strip().lower().startswith("<svg")
            ):
                _warn(f"{self.__get_display_name(var_name)}: file '{value}' does not exist.")
            return str(value)
        if image:
            if not mime:
                mime = self.__get_mime_from_file(path)
            if mime and not mime.startswith("image"):
                _warn(f"{self.__get_display_name(var_name)}: file '{path}' mime type ({mime}) is not an image.")
                return f"Invalid content: {mime}"
        dir_path = path.resolve().parent
        url_path = self.get_path(dir_path)
        self.__content_paths[url_path] = dir_path
        file_url = f"{url_path}/{path.name}"
        self.__url_is_image[file_url] = image
        return (file_url,)
    elif _has_magic_module:
        try:
            mime = magic.from_buffer(value, mime=True)
            if not image or mime.startswith("image"):
                return f"data:{mime};base64," + str(base64.b64encode(value), "utf-8")
            _warn(f"{self.__get_display_name(var_name)}: ({type(value)}) does not have an image mime type: {mime}.")
            return f"Invalid content: {mime}"
        except Exception as e:
            _warn(f"{self.__get_display_name(var_name)}: ({type(value)}) cannot be base64 encoded:\n{e}")
            return "Cannot be base64 encoded"
    else:
        _warn(
            "python-magic (and python-magic-bin on Windows) packages need to be installed if you want to process content as an array of bytes."
        )
        return "Cannot guess content type"