code: def _get_prefix(prefix: str, lit_resource) -> str:
      if isinstance(lit_resource, Externalv1LightningappInstance):
          return _add_resource_prefix(
              prefix, f"lightningapps/{lit_resource.id}"
          )
  
      return _add_resource_prefix(
          prefix, f"cloudspaces/{lit_resource.id}"
      )
  
imports: import contextlib
  import os
  import sys
  from contextlib import nullcontext
  from typing import Generator, List, Optional
  import click
  import lightning_cloud
  import rich
  from lightning_cloud.openapi import Externalv1LightningappInstance
  from rich.console import Console
  from rich.live import Live
  from rich.spinner import Spinner
  from rich.text import Text
  from lightning.app.cli.connect.app import _LIGHTNING_CONNECTION_FOLDER
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.cli_helpers import _error_and_exit
  from lightning.app.utilities.network import LightningClient
label_desc: Use image node_id 6 for calling a global function with example usage: _get_prefix(prefix, lit_resource) and returns: _add_resource_prefix, _add_resource_prefix