title: Get the docstring from a frame object
body: <p>I use the following code to <a href="https://stackoverflow.com/questions/900392/getting-the-caller-function-name-inside-another-function-in-python">get the caller's method name in the called method</a>:</p>
  
  <pre><code>import inspect
  
  def B():
      outerframe = inspect.currentframe().f_back
      functionname = outerframe.f_code.co_name
      docstring = ??
      return "caller's name: {0}, docsting: {1}".format(functionname, docstring)
  
  def A():
      """docstring for A"""
      return B()
  
  
  print A()
  </code></pre>
  
  <p>but I also want to get the docstring from the caller's method in the called method. How do I do that?</p>