It turns out that trace
has built-in support for just this use case. trace.Trace().runfunc(funcObject, *args)
does exactly this.
From the docs:
runfunc(func, *args, **kwds)
Call func with the given arguments under control of the Trace object with the current tracing parameters.