docs: def _set_object_doc(self, obj, doc, stacklevel=3):
          """Convenience method to set the __doc__ attribute of a python object
          """
          if isinstance(obj, types.MethodType) and six.PY2:
              obj = obj.im_func
          try:
              obj.__doc__ = doc
          except AttributeError:  # probably python2 class
              if (self.python2_classes != 'raise' and
                      (inspect.isclass(obj) and six.PY2)):
                  if self.python2_classes == 'warn':
                      warn("Cannot modify docstring of classes in python2!",
                           stacklevel=stacklevel)
              else:
                  raise
          return obj