code: def api_key(settings: Optional["Settings"] = None) -> Optional[str]:
      if settings is None:
          settings = wandb.setup().settings  # type: ignore
          assert settings is not None
      if settings.api_key:
          return settings.api_key
      auth = requests.utils.get_netrc_auth(settings.base_url)
      if auth:
          return auth[-1]
      return None
  
file_path: wandb/wandb/sdk/lib/apikey.py
imports: import os
  import stat
  import sys
  import textwrap
  from functools import partial
  from typing import TYPE_CHECKING, Callable, Dict, Optional, Union
  from urllib.parse import urlparse
  import click
  import requests.utils
  import wandb
  from wandb.apis import InternalApi
  from wandb.errors import term
  from wandb.util import _is_databricks, isatty, prompt_choices
  from .wburls import wburls
label_desc: Use image node_id 6 for calling a global function with example usage: api_key(settings) and returns: None, settings, auth