Decorator to set docstring for *func* from *mro*

def _copy_ancestor_docstring(mro_list, func):  # pylint: disable=W0613
    """Decorator to set docstring for *func* from *mro*"""
    if func.__doc__ is not None:
        raise RuntimeError('Function already has docstring')
    # Search for docstring in superclass
    for cls in mro_list:
        super_fn = getattr(cls, func.__name__, None)
        if super_fn is None:
            continue
        func.__doc__ = super_fn.__doc__
        break
    else:
        raise RuntimeError("Can't inherit docstring for %s: method does not "
                           "exist in superclass" % func.__name__)
    return func