code: def _get_precision_by_name(
      device: torch.device,
      device_target: str,
      tol_val: float,
      tol_val_default: float = 1e-4,
  ) -> float:
      if device_target not in ["cpu", "cuda", "xla", "mps"]:
          raise ValueError(f"Invalid device name: {device_target}.")
  
      if device_target in device.type:
          return tol_val
  
      return tol_val_default
  
imports: import importlib.util
  import math
  from abc import ABC, abstractmethod
  from copy import deepcopy
  from itertools import product
  from typing import Any, Callable, Dict, Iterator, Optional, Sequence, Tuple, TypeVar, Union
  import torch
  from torch.autograd import gradcheck
  from torch.testing import assert_close
  from kornia.core import Device, Dtype, Tensor, eye, tensor
label_desc: Use image node_id 14 for calling a global function with example usage: _get_precision_by_name(device, device_target, tol_val, tol_val_default) and returns: tol_val_default, tol_val