How can I create bound methods with type()?
<p>I am dynamically generating a function and assigning it to a class. This is a simple/minimal example of what I am trying to achieve:</p>

<pre><code>def echo(obj):
    print obj.hello

class Foo(object):
    hello = "Hello World"

spam = type("Spam", (Foo, ), {"echo":echo})
spam.echo()
</code></pre>

<p>Results in this error</p>

<pre><code>Traceback (most recent call last):
File "&lt;input&gt;", line 1, in &lt;module&gt;
TypeError: unbound method echo() must be called with Spam instance
    as first argument (got nothing instead)
</code></pre>

<p>I know if I used the <code>@staticmethod</code> decorator that I can pass <code>spam</code> in as a parameter to echo, but that is not possible for me in my use case.</p>

<p>How would I get the <code>echo</code> function to be bound to <code>Spam</code> and access <code>self</code>?  Is it possible at all?</p>
