Refactor `create_report` to split out report block
Refactor `create_report` to split out report block

Moves block of code that is being profiled in the tests to a separate
method that returns a lambda.  This allows the method to be reused in
future refactorings.

dgynn/memory_profiler,SamSaffron/memory_profiler