'A trace function that raises an exception in response to a
specific trace event.'

def trace(self, frame, event, arg):

    if (event == self.raiseOnEvent):
        raise ValueError
    else:
        return self.trace
