<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 """Spy usage of given `fn`. Patches the module, class or object `fn` lives in, so that all interactions can be recorded; otherwise executes `fn` as before, so that all side effects happen as before. E.g.:: import time spy(time.time) verify(time).time() Note that builtins often cannot be patched because they're read-only. """

    if isinstance(fn, str):
        answer = get_obj(fn)
    else:
        answer = fn

    when2(fn, Ellipsis).thenAnswer(answer)