MNT: Fixed behavior of docstring(pyobj) function

- Returns a numpydoc.docscrape.FunctionDoc object if pyobj is
  a function

- Returns a numpydoc.docscrape.ClassDoc object if pyobj is
  a class