class_docstr: Initialise a BIFWriter Object
  
  Parameters
  ----------
  model: BayesianNetwork Instance
  
  round_values: int (default: None)
      Round the probability values to `round_values` decimals. If None, keeps all decimal points.
  
  Examples
  ---------
  >>> from pgmpy.readwrite import BIFWriter
  >>> from pgmpy.utils import get_example_model
  >>> asia = get_example_model('asia')
  >>> writer = BIFWriter(asia)
  >>> writer
  <writer_BIF.BIFWriter at 0x7f05e5ea27b8>
  >>> writer.write_bif('asia.bif')
docstr: Returns the BIF format as string
code: def __str__(self):
      """
      Returns the BIF format as string
      """
      (
          network_template,
          variable_template,
          property_template,
          probability_template,
          conditional_probability_template_total,
          conditional_probability_template,
      ) = self.BIF_templates()
      network = ""
      network += network_template.substitute(name=self.network_name)
      variables = self.model.nodes()
  
      for var in sorted(variables):
          no_of_states = str(len(self.variable_states[var]))
          states = ", ".join(self.variable_states[var])
          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 += variable_template.substitute(
              name=var,
              no_of_states=no_of_states,
              states=states,
              properties=properties,
          )
  
      for var in sorted(variables):
          if not self.variable_parents[var]:
              parents = ""
              separator = ""
              cpd = ", ".join(map(str, self.tables[var]))
              network += probability_template.substitute(
                  variable_=var,
                  separator_=separator,
                  parents=parents,
                  values=cpd,
              )
          else:
              parents_str = ", ".join(self.variable_parents[var])
              separator = " | "
              cpd = self.model.get_cpds(var)
              cpd_values_transpose = cpd.get_values().T
  
              parent_states = product(
                  *[cpd.state_names[var] for var in cpd.variables[1:]]
              )
              all_cpd = ""
              for index, state in enumerate(parent_states):
                  all_cpd += (
                      conditional_probability_template.substitute(
                          state=", ".join(map(str, state)),
                          values=", ".join(
                              map(
                                  str,
                                  compat_fns.to_numpy(
                                      cpd_values_transpose[index, :],
                                      decimals=self.round_values,
                                  ),
                              )
                          ),
                      )
                  )
              network += (
                  conditional_probability_template_total.substitute(
                      variable_=var,
                      separator_=separator,
                      parents=parents_str,
                      values=all_cpd,
                  )
              )
      return network
  
imports: import collections
  import re
  from copy import copy
  from itertools import product
  from string import Template
  import numpy
  import pyparsing
  from joblib import Parallel, delayed
  from pyparsing import CharsNotIn, Group, OneOrMore, Optional, Suppress, Word, ZeroOrMore, alphanums, cppStyleComment, nums, printables
  from pgmpy.factors.discrete import TabularCPD
  from pgmpy.models import BayesianNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 3 for calling the BIFWriter obj's underlying member method code with example usage: obj.__str__() and returns: network