'A decorator that wraps ``func``, and captures each call to ``func``,
recording the stack trace, and optionally the arguments that the function
is called with.
Arguments:
func: the function to wrap
stack_depth: how far up the stack to truncate the stored stack traces (
this is counted from the call to ``capture_call``, rather than calls
to the captured function).'

@classmethod
def capture_call(cls, func, stack_depth, include_arguments=True):

    stacks = StackTraceCounter(stack_depth, include_arguments)
    @functools.wraps(func)
    def capture(*args, **kwargs):
        stacks.capture_stack(args, kwargs)
        return func(*args, **kwargs)
    capture.stack_counter = stacks
    return capture
