code: def create_cookie(
          key: str,
          value: str='',
          max_age: Optional[Union[int, timedelta]]=None,
          expires: Optional[Union[int, float, datetime]]=None,
          path: str='/',
          domain: Optional[str]=None,
          secure: bool=False,
          httponly: bool=False,
  ) -> SimpleCookie:
      
      cookie = SimpleCookie()
      cookie[key] = value
      cookie[key]['path'] = path
      cookie[key]['httponly'] = httponly  # type: ignore
      cookie[key]['secure'] = secure  # type: ignore
      if isinstance(max_age, timedelta):
          cookie[key]['max-age'] = f"{max_age.total_seconds():d}"
      if isinstance(max_age, int):
          cookie[key]['max-age'] = str(max_age)
      if expires is not None and isinstance(expires, (int, float)):
          cookie[key]['expires'] = format_date_time(int(expires))
      elif expires is not None and isinstance(expires, datetime):
          cookie[key]['expires'] = format_date_time(expires.replace(tzinfo=timezone.utc).timestamp())
      if domain is not None:
          cookie[key]['domain'] = domain
      return cookie
docs: Create a Cookie given the options set
  
      The arguments are the standard cookie morsels and this is a
      wrapper around the stdlib SimpleCookie code.