code: def get_dot(stop=True):
      
      defaults = []
      nodes    = []
      edges    = []
  
  
      # define default attributes
      for comp, comp_attr in graph_attributes.items():
          attr = ', '.join( '%s = "%s"' % (attr, val)
                           for attr, val in comp_attr.items() )
          defaults.append( '\t%(comp)s [ %(attr)s ];\n' % locals() )
  
      # define nodes
      for func, hits in func_count.items():
          calls_frac, total_time_frac, total_time = _frac_calculation(func, hits)
          col = settings['node_colour'](calls_frac, total_time_frac)
          attribs = ['%s="%s"' % a for a in settings['node_attributes'].items()]
          node_str = '"%s" [%s];' % (func, ', '.join(attribs))
          nodes.append( node_str % locals() )
  
      # define edges
      for fr_key, fr_val in call_dict.items():
          if not fr_key: continue
          for to_key, to_val in fr_val.items():
              calls_frac, total_time_frac, totla_time = \
                  _frac_calculation(to_key, to_val)
              col = settings['edge_colour'](calls_frac, total_time_frac)
              edge = '[ color = "%s", label="%s" ]' % (col, to_val)
              edges.append('"%s"->"%s" %s;' % (fr_key, to_key, edge))
  
      defaults = '\n\t'.join( defaults )
      nodes    = '\n\t'.join( nodes )
      edges    = '\n\t'.join( edges )
  
      dot_fmt = ("digraph G {\n"
                 "	%(defaults)s\n\n"
                 "	%(nodes)s\n\n"
                 "	%(edges)s\n}\n"
                )
      return dot_fmt % locals()
docs: Returns a string containing a DOT file. Setting stop to True will cause
      the trace to stop.