title: Python (Inspect) Get functions inside a function
body: <p>I need a function that give me all functions from inside a function.
  Here is my example target, the method that I need is the magic_function_finder (untested, fast writed, maybe not working at last.)</p>
  
  <pre><code>error = {"code": -1, "name":"TEST", "desc": "TEST ERROR"}
  class Something:
      @staticmethod
      def buildError(errorObj):        
          return errorObj
  
  class AnotherThing:
      def f1():
          raise Something.buildError(error);
  
  def f2(arg):
      t = AnotherThing()
      t.f1()
  
  def get_inside_funcs(func, ret=[]):
      for func, args in magic_function_finder(f2):        
          if(Something.buildError is func):
              ret.append(args)
              return ret
          else:
              return get_inside_funcs(func, ret)
  
  print get_inside_funcs(f2)
  &gt;&gt;[{"code": -1, "name":"TEST", "desc": "TEST ERROR"}]
  </code></pre>