code: def print_boolean_net(self, out_file=None):
          init_str = ''
          for node_key in self.graph.nodes():
              node_name = self.graph.node[node_key]['name']
              init_str += '%s = False\n' % node_name
          rule_str = ''
          for node_key in self.graph.nodes():
              node_name = self.graph.node[node_key]['name']
              in_edges = self.graph.in_edges(node_key)
              if not in_edges:
                  continue
              parents = [e[0] for e in in_edges]
              polarities = [self.graph.edge[e[0]][node_key]['polarity']
                            for e in in_edges]
              pos_parents = [par for par, pol in zip(parents, polarities) if
                             pol == 'positive']
              neg_parents = [par for par, pol in zip(parents, polarities) if
                             pol == 'negative']
              rhs_pos_parts = []
              for par in pos_parents:
                  rhs_pos_parts.append(self.graph.node[par]['name'])
              rhs_pos_str = ' or '.join(rhs_pos_parts)
              rhs_neg_parts = []
              for par in neg_parents:
                  rhs_neg_parts.append(self.graph.node[par]['name'])
              rhs_neg_str = ' or '.join(rhs_neg_parts)
              if rhs_pos_str:
                  if rhs_neg_str:
                      rhs_str = '(' + rhs_pos_str + \
                                ') and not (' + rhs_neg_str + ')'
                  else:
                      rhs_str = rhs_pos_str
              else:
                  rhs_str = 'not (' + rhs_neg_str + ')'
              node_eq = '%s* = %s\n' % (node_name, rhs_str)
              rule_str += node_eq
          full_str = init_str + '\n' + rule_str
          if out_file is not None:
              with open(out_file, 'wt') as fh:
                  fh.write(full_str)
          return full_str