code: def _get_random_data_with_fidelity(
      batch_shape: torch.Size,
      m: int,
      n_fidelity: int,
      d: int = 1,
      n: int = 10,
      **tkwargs,
  ) -> Tuple[Tensor, Tensor]:
      r"""Construct test data.
      For this test, by convention the trailing dimensions are the fidelity dimensions
      """
      train_x, train_y = _get_random_data(
          batch_shape=batch_shape, m=m, d=d, n=n, **tkwargs
      )
      s = torch.rand(n, n_fidelity, **tkwargs).repeat(
          batch_shape + torch.Size([1, 1])
      )
      train_x = torch.cat((train_x, s), dim=-1)
      train_y = train_y + (1 - s).pow(2).sum(dim=-1).unsqueeze(-1)
      return train_x, train_y
  
imports: import itertools
  import warnings
  from typing import Tuple
  import torch
  from botorch.exceptions.errors import UnsupportedError
  from botorch.exceptions.warnings import OptimizationWarning
  from botorch.fit import fit_gpytorch_mll
  from botorch.models.gp_regression_fidelity import FixedNoiseMultiFidelityGP, SingleTaskMultiFidelityGP
  from botorch.models.transforms import Normalize, Standardize
  from botorch.posteriors import GPyTorchPosterior
  from botorch.sampling import SobolQMCNormalSampler
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.testing import _get_random_data, BotorchTestCase
  from gpytorch.kernels.scale_kernel import ScaleKernel
  from gpytorch.likelihoods import FixedNoiseGaussianLikelihood
  from gpytorch.means import ConstantMean
  from gpytorch.mlls.exact_marginal_log_likelihood import ExactMarginalLogLikelihood
  from torch import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _get_random_data_with_fidelity(batch_shape, m, n_fidelity, d, n) and returns: train_x,  train_y