code: def new_ray_session(
      address: str = None,
      session_id: str = None,
      backend: str = "mars",
      default: bool = True,
      **new_cluster_kwargs,
  ) -> AbstractSession:
      """
  
      Parameters
      ----------
      address: str
          mars web server address.
      session_id: str
          session id. If not specified, will be generated automatically.
      backend: str
          The executor backend. Available values are "mars" and "ray", default is "mars".
      default: bool
          whether set the session as default session.
      new_cluster_kwargs:
          See `new_cluster` arguments.
      """
      client = None
      if not address:
          client = new_cluster_in_ray(
              backend=backend, **new_cluster_kwargs
          )
          session_id = session_id or client.session.session_id
          address = client.address
      session = new_session(
          address=address,
          session_id=session_id,
          backend=backend,
          default=default,
      )
      session.client = client
      if default:
          # SyncSession set isolated_session as default session instead.
          AbstractSession.default.client = client
      return session
  
imports: import asyncio
  import itertools
  import logging
  import os
  import time
  from typing import Union, Dict, List, Optional, AsyncGenerator
  from ...None import oscar
  from ...core.entrypoints import init_extension_entrypoints
  from ...metrics import init_metrics
  from ...oscar.backends.ray.driver import RayActorDriver
  from ...oscar.backends.ray.utils import process_placement_to_address, node_placement_to_address, process_address_to_placement
  from ...oscar.backends.ray.pool import RayPoolState
  from ...oscar.backends.router import Router
  from ...oscar.errors import ReconstructWorkerError
  from ...resource import Resource
  from ...services.cluster.backends.base import register_cluster_backend, AbstractClusterBackend
  from ...services import NodeRole
  from ...services.task.execution.api import ExecutionConfig
  from ...session import _new_session, new_session, AbstractSession, ensure_isolation_created
  from ...utils import lazy_import, retry_callable
  from ..utils import load_config, get_third_party_modules_from_config
  from .service import start_supervisor, start_worker, stop_supervisor, stop_worker
  from .pool import create_supervisor_actor_pool, create_worker_actor_pool
label_desc: Use image node_id 3 for calling a global function with example usage: new_ray_session(address, session_id, backend, default) and returns: session