code: def serve(
      files,
      immutable,
      host,
      port,
      uds,
      reload,
      cors,
      sqlite_extensions,
      inspect_file,
      metadata,
      template_dir,
      plugins_dir,
      static,
      memory,
      config,
      settings,
      secret,
      root,
      get,
      token,
      actor,
      version_note,
      help_settings,
      pdb,
      open_browser,
      create,
      crossdb,
      nolock,
      ssl_keyfile,
      ssl_certfile,
      internal,
      return_instance=False,
  ):
      """Serve up specified SQLite database files with a web UI"""
      if help_settings:
          formatter = formatting.HelpFormatter()
          with formatter.section("Settings"):
              formatter.write_dl(
                  [
                      (
                          option.name,
                          f"{option.help} (default={option.default})",
                      )
                      for option in SETTINGS
                  ]
              )
          click.echo(formatter.getvalue())
          sys.exit(0)
      if reload:
          import hupper
  
          reloader = hupper.start_reloader("datasette.cli.serve")
          if immutable:
              reloader.watch_files(immutable)
          if config:
              reloader.watch_files([config.name])
          if metadata:
              reloader.watch_files([metadata.name])
  
      inspect_data = None
      if inspect_file:
          with open(inspect_file) as fp:
              inspect_data = json.load(fp)
  
      metadata_data = None
      if metadata:
          metadata_data = fail_if_plugins_in_metadata(
              parse_metadata(metadata.read())
          )
  
      config_data = None
      if config:
          config_data = parse_metadata(config.read())
  
      config_data = config_data or {}
  
      # Merge in settings from -s/--setting
      if settings:
          settings_updates = pairs_to_nested_config(settings)
          config_data.update(settings_updates)
  
      kwargs = dict(
          immutables=immutable,
          cache_headers=not reload,
          cors=cors,
          inspect_data=inspect_data,
          config=config_data,
          metadata=metadata_data,
          sqlite_extensions=sqlite_extensions,
          template_dir=template_dir,
          plugins_dir=plugins_dir,
          static_mounts=static,
          settings=None,  # These are passed in config= now
          memory=memory,
          secret=secret,
          version_note=version_note,
          pdb=pdb,
          crossdb=crossdb,
          nolock=nolock,
          internal=internal,
      )
  
      # if files is a single directory, use that as config_dir=
      if 1 == len(files) and os.path.isdir(files[0]):
          kwargs["config_dir"] = pathlib.Path(files[0])
          files = []
  
      # Verify list of files, create if needed (and --create)
      for file in files:
          if not pathlib.Path(file).exists():
              if create:
                  sqlite3.connect(file).execute("vacuum")
              else:
                  raise click.ClickException(
                      "Invalid value for '[FILES]...': Path '{}' does not exist.".format(
                          file
                      )
                  )
  
      # De-duplicate files so 'datasette db.db db.db' only attaches one /db
      files = list(dict.fromkeys(files))
  
      try:
          ds = Datasette(files, **kwargs)
      except SpatialiteNotFound:
          raise click.ClickException(
              "Could not find SpatiaLite extension"
          )
      except StartupError as e:
          raise click.ClickException(e.args[0])
  
      if return_instance:
          # Private utility mechanism for writing unit tests
          return ds
  
      # Run the "startup" plugin hooks
      asyncio.get_event_loop().run_until_complete(ds.invoke_startup())
  
      # Run async soundness checks - but only if we're not under pytest
      asyncio.get_event_loop().run_until_complete(check_databases(ds))
  
      if token and not get:
          raise click.ClickException(
              "--token can only be used with --get"
          )
  
      if get:
          client = TestClient(ds)
          headers = {}
          if token:
              headers["Authorization"] = "Bearer {}".format(token)
          cookies = {}
          if actor:
              cookies["ds_actor"] = client.actor_cookie(
                  json.loads(actor)
              )
          response = client.get(get, headers=headers, cookies=cookies)
          click.echo(response.text)
          exit_code = 0 if response.status == 200 else 1
          sys.exit(exit_code)
          return
  
      # Start the server
      url = None
      if root:
          url = "http://{}:{}{}?token={}".format(
              host, port, ds.urls.path("-/auth-token"), ds._root_token
          )
          click.echo(url)
      if open_browser:
          if url is None:
              # Figure out most convenient URL - to table, database or homepage
              path = asyncio.get_event_loop().run_until_complete(
                  initial_path_for_datasette(ds)
              )
              url = f"http://{host}:{port}{path}"
          webbrowser.open(url)
      uvicorn_kwargs = dict(
          host=host,
          port=port,
          log_level="info",
          lifespan="on",
          workers=1,
      )
      if uds:
          uvicorn_kwargs["uds"] = uds
      if ssl_keyfile:
          uvicorn_kwargs["ssl_keyfile"] = ssl_keyfile
      if ssl_certfile:
          uvicorn_kwargs["ssl_certfile"] = ssl_certfile
      uvicorn.run(ds.app(), **uvicorn_kwargs)
  
imports: import asyncio
  import uvicorn
  import click
  from click import formatting
  from click.types import CompositeParamType
  from click_default_group import DefaultGroup
  import functools
  import json
  import os
  import pathlib
  from runpy import run_module
  import shutil
  from subprocess import call
  import sys
  import textwrap
  import webbrowser
  from .app import OBSOLETE_SETTINGS, Datasette, DEFAULT_SETTINGS, SETTINGS, SQLITE_LIMIT_ATTACHED, pm
  from .utils import LoadExtension, StartupError, check_connection, find_spatialite, parse_metadata, ConnectionProblem, SpatialiteConnectionProblem, initial_path_for_datasette, pairs_to_nested_config, temporary_docker_directory, fail_if_plugins_in_metadata, value_as_boolean, SpatialiteNotFound, StaticMount, ValueAsBooleanError
  from .utils.sqlite import sqlite3
  from .utils.testing import TestClient
  from .version import __version__
label_desc: Use image node_id 9 for calling a global function with example usage: serve(files, immutable, host, port, uds, reload, cors, sqlite_extensions, inspect_file, metadata, template_dir, plugins_dir, static, memory, config, settings, secret, root, get, token, actor, version_note, help_settings, pdb, open_browser, create, crossdb, nolock, ssl_keyfile, ssl_certfile, internal, return_instance) and returns: ds