How to copy a class instance in python? : <p>I would like to make a copy of a class instance in python. I tried <code>copy.deepcopy</code> but I get the error message:</p>

<blockquote>
  <p>RuntimeError: Only Variables created explicitly by the user (graph leaves) support the deepcopy protocol at the moment</p>
</blockquote>

<p>So suppose I have something like:</p>

<pre><code>class C(object):
    def __init__(self,a,b, **kwargs):
        self.a=a
        self.b=b
        for x, v in kwargs.items():
            setattr(self, x, v)

c = C(4,5,'r'=2)
c.a = 11
del c.b
</code></pre>

<p>And now I want to make an identical deep copy of <code>c</code>, is there an easy way?</p>
