title: Cast base class to derived class python (or more pythonic way of extending classes)
body: <p>I need to extend the Networkx python package and add a few methods to the <code>Graph</code> class for my particular need</p>
  
  <p>The way I thought about doing this is simplying deriving a new class say <code>NewGraph</code>, and adding the required methods.</p>
  
  <p>However there are several other functions in networkx which create and return <code>Graph</code> objects (e.g. generate a random graph).  I now need to turn these <code>Graph</code> objects into <code>NewGraph</code> objects so that I can use my new methods.</p>
  
  <p>What is the best way of doing this?  Or should I be tackling the problem in a completely different manner?</p>