docs: def check_model(self):
          """
          Check the model for various errors. This method checks for the following
          errors.
  
          * Checks if factors are defined for all the cliques or not.
          * Check for running intersection property is not done explicitly over
            here as it done in the add_edges method.
          * Checks if cardinality information for all the variables is availble or not. If
            not it raises an error.
          * Check if cardinality of random variable remains same across all the
            factors.
  
          Returns
          -------
          check: boolean
              True if all the checks are passed
          """
          for clique in self.nodes():
              factors = filter(lambda x: set(x.scope()) == set(clique), self.factors)
              if not any(factors):
                  raise ValueError('Factors for all the cliques or clusters not defined.')
  
          cardinalities = self.get_cardinality()
          if len(set((x for clique in self.nodes() for x in clique))) != len(cardinalities):
              raise ValueError('Factors for all the variables not defined.')
  
          for factor in self.factors:
              for variable, cardinality in zip(factor.scope(), factor.cardinality):
                  if (cardinalities[variable] != cardinality):
                      raise ValueError(
                          'Cardinality of variable {var} not matching among factors'.format(var=variable))
  
          return True