Adapt module detection for line_profiler
Clean code