code: def check_logged_in(api: Api, host: str) -> bool:
      print("Checking if logged in".ljust(72, "."), end="")
      login_doc_url = "https://docs.wandb.ai/ref/cli/wandb-login"
      fail_string = None
      if api.api_key is None:
          fail_string = "Not logged in. Please log in using `wandb login`. See the docs: {}".format(
              click.style(login_doc_url, underline=True, fg="blue")
          )
      # check that api key is correct
      # TODO: Better check for api key is correct
      else:
          res = api.api.viewer()
          if not res:
              fail_string = (
                  "Could not get viewer with default API key. "
                  f"Please relogin using `WANDB_BASE_URL={host} wandb login --relogin` and try again"
              )
  
      print_results(fail_string, False)
      return fail_string is None
  
imports: import getpass
  import os
  import time
  from functools import partial
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import click
  import requests
  from pkg_resources import parse_version
  from wandb_gql import gql
  import wandb
  from wandb.sdk.artifacts.artifact import Artifact
  from wandb.sdk.lib import runid
  from ...apis.internal import Api
label_desc: Use image node_id 4 for calling a global function with example usage: check_logged_in(api, host) and returns: unknown