code: def _expectation_markov_generic(
      p: MarkovGaussian,
      obj1: ExpectationObject,
      feat1: Optional[InducingVariables],
      obj2: ExpectationObject,
      feat2: Optional[InducingVariables],
      nghp: None = None,
  ) -> tf.Tensor:
      """
      Nota Bene: if only one object is passed, obj1 is
      associated with x_n, whereas obj2 with x_{n+1}
  
      """
      if obj2 is None:
          gaussian = Gaussian(p.mu[:-1], p.cov[0, :-1])
          return expectation(
              gaussian,
              cast(PackedExpectationObject, (obj1, feat1)),
              nghp=nghp,
          )
      elif obj1 is None:
          gaussian = Gaussian(p.mu[1:], p.cov[0, 1:])
          return expectation(
              gaussian,
              cast(PackedExpectationObject, (obj2, feat2)),
              nghp=nghp,
          )
      else:
          return expectation(
              p,
              cast(PackedExpectationObject, (obj1, feat1)),
              cast(PackedExpectationObject, (obj2, feat2)),
              nghp=nghp,
          )
  
file_path: GPflow/gpflow/expectations/misc.py
imports: from typing import Optional, Type, Union, cast
  import tensorflow
  from check_shapes import check_shapes
  from ..None import kernels
  from ..None import mean_functions
  from ..inducing_variables import InducingPoints, InducingVariables
  from ..probability_distributions import DiagonalGaussian, Gaussian, MarkovGaussian
  from .None import dispatch
  from .expectations import ExpectationObject, PackedExpectationObject, expectation
label_desc: Use image node_id 7 for calling a global function with example usage: _expectation_markov_generic(p, obj1, feat1, obj2, feat2, nghp) and returns: expectation, expectation, expectation