code: def save(self, cfg, filename, print_ir=False, format='dot', options=None):
          
          if options is None:
              options = {}
  
          try:
              dot_graph = Dot(**self.graph_format)
  
              # Add nodes.
              nodes = {}
              for bb in cfg.basic_blocks:
                  nodes[bb.address] = self._create_node(bb, cfg.name, print_ir, options)
  
                  dot_graph.add_node(nodes[bb.address])
  
              # Add edges.
              for bb_src in cfg.basic_blocks:
                  for bb_dst_addr, branch_type in bb_src.branches:
                      if bb_dst_addr in nodes:
                          edge = self._create_edge(nodes[bb_src.address], nodes[bb_dst_addr], branch_type)
  
                          dot_graph.add_edge(edge)
                      else:
                          logger.warning("Destination basic block not found! (0x%x)", bb_dst_addr)
  
              # Save graph.
              dot_graph.write("{}.{}".format(filename, format), format=format)
          except Exception:
              logger.error("Failed to save basic block graph: %s (%s)", filename, format, exc_info=True)
docs: Save basic block graph into a file.