class_docstr: Initialize an instance of UAI writer class
  
  Parameters
  ----------
  model: A Bayesian or Markov model
      The model to write
  
  round_values: int (default: None)
      The number to decimals to which to round the probability values. If None, keeps all decimals points.
  
  Examples
  --------
  >>> from pgmpy.readwrite import UAIWriter
  >>> from pgmpy.utils import get_example_model
  >>> model = get_example_model('asia')
  >>> writer = UAIWriter(asia)
  >>> writer.write_uai('asia.uai')
docstr: Adds domain of each variable to the network.
  
  Examples
  --------
  >>> from pgmpy.readwrite import UAIWriter
  >>> writer = UAIWriter(model)
  >>> writer.get_domain()
docstr_tok: ["Adds","domain","of","each","variable","to","the","network",".","Examples","--","--","--","--",">",">",">","from","pgmpy.readwrite","import","UAIWriter",">",">",">","writer","=","UAIWriter","(","model",")",">",">",">","writer.get_domain","(",")"]
code: def get_domain(self):
      """
      Adds domain of each variable to the network.
  
      Examples
      --------
      >>> from pgmpy.readwrite import UAIWriter
      >>> writer = UAIWriter(model)
      >>> writer.get_domain()
      """
      if isinstance(self.model, BayesianNetwork):
          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, MarkovNetwork):
          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."
          )
  
imports: from itertools import combinations
  import numpy
  from pyparsing import Combine, Literal, Optional, Regex, Word, alphas, nums
  from pgmpy.factors.discrete import DiscreteFactor, TabularCPD
  from pgmpy.models import BayesianNetwork, MarkovNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 4 for calling the UAIWriter obj's underlying member method code with example usage: obj.get_domain() and returns: domain, domain