code: def __init__(self, app, on_startup=None, on_shutdown=None):
      self.app = app
      on_startup = on_startup or []
      on_shutdown = on_shutdown or []
      if not isinstance(on_startup or [], list):
          on_startup = [on_startup]
      if not isinstance(on_shutdown or [], list):
          on_shutdown = [on_shutdown]
      self.on_startup = on_startup
      self.on_shutdown = on_shutdown
  
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 1 to create a new AsgiLifespan object  with example: obj = AsgiLifespan(app, on_startup, on_shutdown)