docs: def get_domain(self):
          """
          Adds domain of each variable to the network.
  
          Example
          -------
          >>> writer = UAIWriter(model)
          >>> writer.get_domain()
          """
          if isinstance(self.model, BayesianModel):
              cpds = self.model.get_cpds()
              cpds.sort(key=lambda x: x.variable)
              domain = {}
              for cpd in cpds:
                  domain[cpd.variable] = str(cpd.variable_card)
              return domain
          elif isinstance(self.model, MarkovModel):
              factors = self.model.get_factors()
              domain = {}
              for factor in factors:
                  variables = factor.variables
                  for var in variables:
                      if var not in domain:
                          domain[var] = str(factor.get_cardinality([var])[var])
              return domain
          else:
              raise TypeError("Model must be an instance of Markov or Bayesian model.")