Building basic Python sample profiler

Recently I applied for a vacancy and saw this test task: