code: def _field_is_shared(
      datasets: Union[
          Iterable[SupervisedDataset], Dict[Hashable, SupervisedDataset]
      ],
      fieldname: str,
  ) -> bool:
      r"""Determines whether or not a given field is shared by all datasets."""
      if isinstance(datasets, dict):
          datasets = datasets.values()
  
      base = None
      for dataset in datasets:
          if not hasattr(dataset, fieldname):
              raise AttributeError(
                  f"{type(dataset)} object has no field `{fieldname}`."
              )
  
          obj = getattr(dataset, fieldname)
          if base is None:
              base = obj
          elif isinstance(base, Tensor):
              if not torch.equal(base, obj):
                  return False
          elif base != obj:  # pragma: no cover
              return False
  
      return True
  
imports: from __future__ import annotations
  import inspect
  from typing import Any, Callable, Dict, Hashable, Iterable, List, Optional, Sequence, Tuple, Type, TypeVar, Union
  import torch
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.acquisition.analytic import ConstrainedExpectedImprovement, ExpectedImprovement, LogConstrainedExpectedImprovement, LogExpectedImprovement, LogNoisyExpectedImprovement, LogProbabilityOfImprovement, NoisyExpectedImprovement, PosteriorMean, ProbabilityOfImprovement, UpperConfidenceBound
  from botorch.acquisition.cost_aware import InverseCostWeightedUtility
  from botorch.acquisition.fixed_feature import FixedFeatureAcquisitionFunction
  from botorch.acquisition.joint_entropy_search import qJointEntropySearch
  from botorch.acquisition.knowledge_gradient import qKnowledgeGradient, qMultiFidelityKnowledgeGradient
  from botorch.acquisition.logei import qLogExpectedImprovement, qLogNoisyExpectedImprovement, TAU_MAX, TAU_RELU
  from botorch.acquisition.max_value_entropy_search import qMaxValueEntropy, qMultiFidelityMaxValueEntropy
  from botorch.acquisition.monte_carlo import qExpectedImprovement, qNoisyExpectedImprovement, qProbabilityOfImprovement, qSimpleRegret, qUpperConfidenceBound
  from botorch.acquisition.multi_objective import ExpectedHypervolumeImprovement, MCMultiOutputObjective, qExpectedHypervolumeImprovement, qNoisyExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.logei import qLogNoisyExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.objective import AnalyticMultiOutputObjective, IdentityAnalyticMultiOutputObjective, IdentityMCMultiOutputObjective
  from botorch.acquisition.multi_objective.utils import get_default_partitioning_alpha
  from botorch.acquisition.objective import ConstrainedMCObjective, IdentityMCObjective, MCAcquisitionObjective, PosteriorTransform
  from botorch.acquisition.preference import AnalyticExpectedUtilityOfBestOption
  from botorch.acquisition.risk_measures import RiskMeasureMCObjective
  from botorch.acquisition.utils import compute_best_feasible_objective, expand_trace_observations, get_infeasible_cost, get_optimal_samples, project_to_target_fidelity
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.cost import AffineFidelityCostModel
  from botorch.models.deterministic import FixedSingleSampleModel
  from botorch.models.gpytorch import GPyTorchModel
  from botorch.models.model import Model
  from botorch.optim.optimize import optimize_acqf
  from botorch.sampling.base import MCSampler
  from botorch.sampling.normal import IIDNormalSampler, SobolQMCNormalSampler
  from botorch.utils.containers import BotorchContainer
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.multi_objective.box_decompositions.non_dominated import FastNondominatedPartitioning, NondominatedPartitioning
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _field_is_shared(datasets, fieldname) and returns: True, False, False