code: def clear(self, keep_attrs=False):
          
          if not keep_attrs:
              for a in (self.graph_attr, self.node_attr, self.edge_attr):
                  a.clear()
          del self.body[:]
docs: Reset content to an empty body, clear graph/node/egde_attr mappings.
  
          Args:
              keep_attrs (bool): preserve graph/node/egde_attr mappings