code: def _get_project_id_and_resource(
      pwd: str,
  ) -> Tuple[str, Union[Externalv1LightningappInstance, V1CloudSpace]]:
      """Convert a root path to a project id and app id."""
      # TODO: Handle project level
      project_name, resource_name, *_ = pwd.split("/")[1:3]
  
      # 1. Collect the projects of the user
      client = LightningClient()
      projects = client.projects_service_list_memberships()
      project_id = [
          project.project_id
          for project in projects.memberships
          if project.name == project_name
      ][0]
  
      # 2. Collect resources
      lit_apps = client.lightningapp_instance_service_list_lightningapp_instances(
          project_id=project_id
      ).lightningapps
  
      lit_cloud_spaces = client.cloud_space_service_list_cloud_spaces(
          project_id=project_id
      ).cloudspaces
  
      lit_ressources = [
          lit_resource
          for lit_resource in lit_cloud_spaces
          if lit_resource.name == resource_name
      ]
  
      if len(lit_ressources) == 0:
          lit_ressources = [
              lit_resource
              for lit_resource in lit_apps
              if lit_resource.name == resource_name
          ]
  
          if len(lit_ressources) == 0:
              print(
                  f"ERROR: There isn't any Lightning Ressource matching the name {resource_name}."
              )
              sys.exit(0)
  
      return project_id, lit_ressources[0]
  
imports: import concurrent
  import contextlib
  import os
  import sys
  from functools import partial
  from multiprocessing.pool import ApplyResult
  from pathlib import Path
  from textwrap import dedent
  from typing import Any, Optional, Tuple, Union
  import click
  import requests
  import urllib3
  from lightning_cloud.openapi import Externalv1Cluster, Externalv1LightningappInstance, ProjectIdStorageBody, V1CloudSpace, V1GetClusterResponse
  from rich.live import Live
  from rich.progress import BarColumn, DownloadColumn, Progress, TaskID, TextColumn
  from rich.spinner import Spinner
  from rich.text import Text
  from lightning.app.cli.commands.ls import _collect_artifacts, _get_prefix
  from lightning.app.cli.commands.pwd import _pwd
  from lightning.app.source_code import FileUploader
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.auth import _AuthTokenGetter
  from lightning.app.utilities.cli_helpers import _error_and_exit
  from lightning.app.utilities.network import LightningClient
label_desc: Use image node_id 10 for calling a global function with example usage: _get_project_id_and_resource(pwd) and returns: project_id,  lit_ressources