docs: def to_markov_model(self):
          """
          Converts bayesian model to markov model. The markov model created would
          be the moral graph of the bayesian model.
  
          Examples
          --------
          >>> from pgmpy.models import BayesianModel
          >>> G = BayesianModel([('diff', 'grade'), ('intel', 'grade'),
          ...                    ('intel', 'SAT'), ('grade', 'letter')])
          >>> mm = G.to_markov_model()
          >>> mm.nodes()
          ['diff', 'grade', 'intel', 'SAT', 'letter']
          >>> mm.edges()
          [('diff', 'intel'), ('diff', 'grade'), ('intel', 'grade'),
          ('intel', 'SAT'), ('grade', 'letter')]
          """
          moral_graph = self.moralize()
          mm = MarkovModel(moral_graph.edges())
          mm.add_factors(*[cpd.to_factor() for cpd in self.cpds])
  
          return mm