docs: def check_model(self):
          """
          Check the model for various errors. This method checks for the following
          errors -
  
          * Checks if the cardinalities of all the variables are consistent across all the factors.
          * Factors are defined for all the random variables.
  
          Returns
          -------
          check: boolean
              True if all the checks are passed
          """
          cardinalities = self.get_cardinality()
          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))
                  if len(self.nodes()) != len(cardinalities):
                      raise ValueError('Factors for all the variables not defined')
              for var1, var2 in itertools.combinations(factor.variables, 2):
                  if var2 not in self.neighbors(var1):
                      raise ValueError("DiscreteFactor inconsistent with the model.")
          return True