+(declare-function ad-get-advice-info "advice" (function))
+
+(defun find-function-advised-original (func)
+ "Return the original function symbol of an advised function FUNC.
+If FUNC is not the symbol of an advised function, just returns FUNC."
+ (or (and (symbolp func)
+ (featurep 'advice)
+ (let ((ofunc (cdr (assq 'origname (ad-get-advice-info func)))))
+ (and (fboundp ofunc) ofunc)))
+ func))
+