code: def read_settings(path=None, override=None):
      settings = override or {}
  
      if path:
          settings = dict(get_settings_from_file(path), **settings)
  
      if settings:
          settings = handle_deprecated_settings(settings)
  
      if path:
          # Make relative paths absolute
          def getabs(maybe_relative, base_path=path):
              if isabs(maybe_relative):
                  return maybe_relative
              return os.path.abspath(
                  os.path.normpath(
                      os.path.join(
                          os.path.dirname(base_path), maybe_relative
                      )
                  )
              )
  
          for p in ["PATH", "OUTPUT_PATH", "THEME", "CACHE_PATH"]:
              if settings.get(p) is not None:
                  absp = getabs(settings[p])
                  # THEME may be a name rather than a path
                  if p != "THEME" or os.path.exists(absp):
                      settings[p] = absp
  
          if settings.get("PLUGIN_PATHS") is not None:
              settings["PLUGIN_PATHS"] = [
                  getabs(pluginpath)
                  for pluginpath in settings["PLUGIN_PATHS"]
              ]
  
      settings = dict(copy.deepcopy(DEFAULT_CONFIG), **settings)
      settings = configure_settings(settings)
  
      # This is because there doesn't seem to be a way to pass extra
      # parameters to docutils directive handlers, so we have to have a
      # variable here that we'll import from within Pygments.run (see
      # rstdirectives.py) to see what the user defaults were.
      global PYGMENTS_RST_OPTIONS
      PYGMENTS_RST_OPTIONS = settings.get("PYGMENTS_RST_OPTIONS", None)
      return settings
  
file_path: pelican/pelican/settings.py
imports: import copy
  import importlib.util
  import inspect
  import locale
  import logging
  import os
  import re
  import sys
  from os.path import isabs
  from pathlib import Path
  from pelican.log import LimitFilter
label_desc: Use image node_id 2 for calling a global function with example usage: read_settings(path, override) and returns: settings, os, maybe_relative