code: def get_ops(name: str, **kwargs) -> Ops:
      """Get a backend object.
  
      The special name "cpu" returns the best available CPU backend."""
  
      ops_by_name = {ops_cls.name: ops_cls for ops_cls in registry.ops.get_all().values()}  # type: ignore
  
      cls: Optional[Callable[..., Ops]] = None
      if name == "cpu":
          _import_extra_cpu_backends()
          cls = ops_by_name.get("numpy")
          cls = ops_by_name.get("apple", cls)
          cls = ops_by_name.get("bigendian", cls)
      else:
          cls = ops_by_name.get(name)
  
      if cls is None:
          raise ValueError(f"Invalid backend: {name}")
  
      return cls(**kwargs)
  
imports: import contextlib
  import threading
  from contextvars import ContextVar
  from typing import Any, Callable, Dict, Optional, Type, cast
  from ..None import registry
  from ..compat import cupy, has_cupy
  from ..util import assert_pytorch_installed, assert_tensorflow_installed, get_torch_default_device, is_cupy_array, require_cpu
  from ._cupy_allocators import cupy_pytorch_allocator, cupy_tensorflow_allocator
  from ._param_server import ParamServer
  from .cupy_ops import CupyOps
  from .mps_ops import MPSOps
  from .numpy_ops import NumpyOps
  from .ops import Ops
label_desc: Use image node_id 5 for calling a global function with example usage: get_ops(name) and returns: cls