def decompile_function(f, indent=''):
    s = StringIO()
uncompyle(2.7, f.__code__, s)
return """%sdef %s%s:
%s    %s""" % (indent, f.__name__, inspect.
    formatargspec(*inspect.getargspec(f)), indent, ('\n    ' + indent).join
    (''.join(s.buflist).split('\n')))
Recovering .pyc file from python interpreter