code: def _init_expectation(
      p: ProbabilityDistributionLike,
      obj1: PackedExpectationObject,
      obj2: PackedExpectationObject,
  ) -> Tuple[
      ProbabilityDistribution,
      ExpectationObject,
      Optional[InducingVariables],
      ExpectationObject,
      Optional[InducingVariables],
  ]:
      if isinstance(p, tuple):
          mu, cov = p
          classes = [DiagonalGaussian, Gaussian, MarkovGaussian]
          p = classes[cov.ndim - 2](*p)  # type: ignore[abstract]
  
      obj1, feat1 = obj1 if isinstance(obj1, tuple) else (obj1, None)
      obj2, feat2 = obj2 if isinstance(obj2, tuple) else (obj2, None)
      return (
          # type-ignore instead of cast, because it dependes on versions whether a cast is necessary.
          p,  # type: ignore[return-value]
          cast(ExpectationObject, obj1),
          cast(Optional[InducingVariables], feat1),
          cast(ExpectationObject, obj2),
          cast(Optional[InducingVariables], feat2),
      )
  
file_path: GPflow/gpflow/expectations/expectations.py
imports: from typing import Optional, Tuple, Union, cast
  import tensorflow
  from check_shapes import check_shapes
  from ..base import TensorType
  from ..inducing_variables import InducingVariables
  from ..kernels import Kernel
  from ..mean_functions import MeanFunction
  from ..probability_distributions import DiagonalGaussian, Gaussian, MarkovGaussian, ProbabilityDistribution
  from .None import dispatch
label_desc: Use image node_id 3 for calling a global function with example usage: _init_expectation(p, obj1, obj2) and returns: p,  cast,  cast,  cast,  cast