Accept either single dict or list of dicts as function argument
<p>I'd like to accept either one dict or a list of dicts as a function argument. So far, I've come up with the following, but I suspect I've missed something completely obvious, and am using something fragile (<code>isinstance</code>):</p>

<pre><code>def wrap(f):
    def enc(inp):
        if isinstance(inp, list):
            for item in inp:
                f(item)
        else:
            f(inp)
    return enc

@wrap
def prt(arg):
    # do something with the dict
    print arg.keys()
</code></pre>
