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