class_docstr: Initialise a XMLBIFWriter object.
  
  Parameters
  ----------
  model: BayesianNetwork Instance
      Model to write
  
  encoding: str (optional)
      Encoding for text data
  
  prettyprint: Bool(optional)
      Indentation in output XML if true
  
  Examples
  --------
  >>> from pgmpy.readwrite import XMLBIFWriter
  >>> from pgmpy.utils import get_example_model
  >>> model = get_example_model('asia')
  >>> writer = XMLBIFWriter(model)
  >>> writer.write_xmlbif('asia.xml')
  
  Reference
  ---------
  [1] https://www.cs.cmu.edu/afs/cs/user/fgcozman/www/Research/InterchangeFormat/
docstr: Add outcome to variables of XMLBIF
  
  Return
  ------
  dict: dict of type {variable: outcome tags}
  
  Examples
  --------
  >>> writer = XMLBIFWriter(model)
  >>> writer.get_states()
  {'dog-out': [<Element OUTCOME at 0x7ffbabfcdec8>, <Element OUTCOME at 0x7ffbabfcdf08>],
   'family-out': [<Element OUTCOME at 0x7ffbabfd4108>, <Element OUTCOME at 0x7ffbabfd4148>],
   'bowel-problem': [<Element OUTCOME at 0x7ffbabfd4088>, <Element OUTCOME at 0x7ffbabfd40c8>],
   'hear-bark': [<Element OUTCOME at 0x7ffbabfcdf48>, <Element OUTCOME at 0x7ffbabfcdf88>],
   'light-on': [<Element OUTCOME at 0x7ffbabfcdfc8>, <Element OUTCOME at 0x7ffbabfd4048>]}
docstr_tok: ["Add","outcome","to","variables","of","XMLBIF","Return","--","--","--","dict",":","dict","of","type","{","variable",":","outcome","tags","}","Examples","--","--","--","--",">",">",">","writer","=","XMLBIFWriter","(","model",")",">",">",">","writer.get_states","(",")","{","'dog-out","'",":","[","<","Element","OUTCOME","at","0x7ffbabfcdec8",">",",","<","Element","OUTCOME","at","0x7ffbabfcdf08",">","]",",","'family-out","'",":","[","<","Element","OUTCOME","at","0x7ffbabfd4108",">",",","<","Element","OUTCOME","at","0x7ffbabfd4148",">","]",",","'bowel-problem","'",":","[","<","Element","OUTCOME","at","0x7ffbabfd4088",">",",","<","Element","OUTCOME","at","0x7ffbabfd40c8",">","]",",","'hear-bark","'",":","[","<","Element","OUTCOME","at","0x7ffbabfcdf48",">",",","<","Element","OUTCOME","at","0x7ffbabfcdf88",">","]",",","'light-on","'",":","[","<","Element","OUTCOME","at","0x7ffbabfcdfc8",">",",","<","Element","OUTCOME","at","0x7ffbabfd4048",">","]","}"]
code: def get_states(self):
      """
      Add outcome to variables of XMLBIF
  
      Return
      ------
      dict: dict of type {variable: outcome tags}
  
      Examples
      --------
      >>> writer = XMLBIFWriter(model)
      >>> writer.get_states()
      {'dog-out': [<Element OUTCOME at 0x7ffbabfcdec8>, <Element OUTCOME at 0x7ffbabfcdf08>],
       'family-out': [<Element OUTCOME at 0x7ffbabfd4108>, <Element OUTCOME at 0x7ffbabfd4148>],
       'bowel-problem': [<Element OUTCOME at 0x7ffbabfd4088>, <Element OUTCOME at 0x7ffbabfd40c8>],
       'hear-bark': [<Element OUTCOME at 0x7ffbabfcdf48>, <Element OUTCOME at 0x7ffbabfcdf88>],
       'light-on': [<Element OUTCOME at 0x7ffbabfcdfc8>, <Element OUTCOME at 0x7ffbabfd4048>]}
      """
      outcome_tag = {}
      cpds = self.model.get_cpds()
      for cpd in cpds:
          var = cpd.variable
          outcome_tag[var] = []
          if (
              cpd.state_names is None
              or cpd.state_names.get(var) is None
          ):
              states = range(cpd.get_cardinality([var])[var])
          else:
              states = cpd.state_names[var]
  
          for state in states:
              state_tag = etree.SubElement(
                  self.variables[var], "OUTCOME"
              )
              state_tag.text = self._make_valid_state_name(state)
              outcome_tag[var].append(state_tag)
      return outcome_tag
  
imports: import xml.etree.ElementTree
  from io import BytesIO
  from itertools import chain
  import numpy
  import pyparsing
  from pgmpy.factors.discrete import State, TabularCPD
  from pgmpy.models import BayesianNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 5 for calling the XMLBIFWriter obj's underlying member method code with example usage: obj.get_states() and returns: outcome_tag