code: def query_or_cookie_extractor(
      q: Annotated[str, Depends(query_extractor)],
      last_query: Annotated[Union[str, None], Cookie()] = None,
  ):
      if not q:
          return last_query
      return q
  
imports: from typing import Union
  from fastapi import Cookie, Depends, FastAPI
  from typing_extensions import Annotated
label_desc: Use image node_id 2 for calling a global function with example usage: query_or_cookie_extractor(q, last_query) and returns: q, last_query