def METHOD_NAME(self, filepath: Path, library: Optional[str]) -> None:
    try:
        resp = requests.post(
            f"{self.url}/rest/media",
            auth=(self.auth_key, ""),
            files=[
                ("file", (filepath.name, filepath.open("rb"))),
            ],
            timeout=30,
            cookies={"tt_upload": library} if library is not None else {},
        )
        resp.raise_for_status()
    except requests.exceptions.HTTPError as exception:
        raise RuntimeError(f"could not upload {filepath}") from exception