code: def project_response_with_refresh(
      session: CachedSession, name: str, last_serial: int
  ) -> OriginalResponse | CachedResponse:
      """Get a http cached pypi project
  
      force refresh in case of last serial mismatch
      """
  
      response = session.get(f"https://pypi.org/pypi/{name}/json")
      if (
          int(response.headers.get("X-PyPI-Last-Serial", -1))
          != last_serial
      ):
          response = session.get(
              f"https://pypi.org/pypi/{name}/json", refresh=True
          )
      return response
  
imports: import datetime
  import pathlib
  import re
  from textwrap import dedent
  from textwrap import indent
  from typing import Any
  from typing import Iterable
  from typing import Iterator
  from typing import TypedDict
  import packaging.version
  import platformdirs
  import tabulate
  import wcwidth
  from requests_cache import CachedResponse
  from requests_cache import CachedSession
  from requests_cache import OriginalResponse
  from requests_cache import SQLiteCache
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: project_response_with_refresh(session, name, last_serial) and returns: response