class_docstr: Base class for writing network file in net format
  
  Parameters
  ----------
  model: BayesianNetwork Instance
  
  Examples
  ----------
  >>> from pgmpy.readwrite import NETWriter
  >>> from pgmpy.utils import get_example_model
  >>> asia = get_example_model('asia')
  >>> writer = NETWriter(asia)
  >>> writer
  <pgmpy.readwrite.NET.NETWriter at 0x7feac652c2b0>
  >>> writer.write_net('asia.net')
  
  Reference
  ---------
  [1] HUGIN EXPERT A/S . The HUGIN file format. http://www.hugin.com, 2011.
docstr: Return the NET
docstr_tok: ["Return","the","NET"]
code: def __str__(self):
      """Return the NET"""
      (
          network_template,
          node_template,
          potential_template,
          property_template,
      ) = self.NET_templates()
  
      network = ""
      network += network_template.substitute()
      variables = self.variables
  
      for var in sorted(variables):
          quoted_states = [
              '"' + state + '"' for state in self.variable_states[var]
          ]
          states = "  ".join(quoted_states)
  
          if not self.property_tag[var]:
              properties = ""
          else:
              properties = ""
              for prop_val in self.property_tag[var]:
                  properties += property_template.substitute(
                      prop=prop_val
                  )
  
          network += node_template.substitute(
              name=var, states=states, properties=properties
          )
  
      for var in sorted(variables):
          if not self.variable_parents[var]:
              parents = ""
              separator = " |"
          else:
              parents = " ".join(self.variable_parents[var])
              separator = " | "
          potentials = self.net_cpd(var)
          network += potential_template.substitute(
              variable_=var,
              separator_=separator,
              parents=parents,
              values=potentials,
          )
  
      return network
  
imports: import collections
  from math import prod
  from string import Template
  import numpy
  from pyparsing import CharsNotIn, Group, OneOrMore, Optional, Suppress, Word, ZeroOrMore, alphanums, alphas, cppStyleComment, nums, printables
  from pgmpy.factors.discrete.CPD import TabularCPD
  from pgmpy.models import BayesianNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 3 for calling the NETWriter obj's underlying member method code with example usage: obj.__str__() and returns: network