code: def set_cookie(
      self,
      key,
      value="",
      max_age=None,
      expires=None,
      path="/",
      domain=None,
      secure=False,
      httponly=False,
      samesite="lax",
  ):
      assert (
          samesite in SAMESITE_VALUES
      ), "samesite should be one of {}".format(SAMESITE_VALUES)
      cookie = SimpleCookie()
      cookie[key] = value
      for prop_name, prop_value in (
          ("max_age", max_age),
          ("expires", expires),
          ("path", path),
          ("domain", domain),
          ("samesite", samesite),
      ):
          if prop_value is not None:
              cookie[key][prop_name.replace("_", "-")] = prop_value
      for prop_name, prop_value in (
          ("secure", secure),
          ("httponly", httponly),
      ):
          if prop_value:
              cookie[key][prop_name] = True
      self._set_cookie_headers.append(cookie.output(header="").strip())
  
imports: import json
  from datasette.utils import MultiParams
  from mimetypes import guess_type
  from urllib.parse import parse_qs, urlunparse, parse_qsl
  from pathlib import Path
  from http.cookies import SimpleCookie, Morsel
  import aiofiles
  import aiofiles.os
label_desc: Use image node_id 2 for calling the Response obj's underlying member method code with example usage: obj.set_cookie(key, value, max_age, expires, path, domain, secure, httponly, samesite) without return types