How would you refactor this specific block of legacy code to make it more testable and maintainable?
Given a Python source string, return the single best refactoring recommendation. Focus on separating pure logic from side effects, extracting small testable functions, or injecting dependencies when needed.
def refactor_legacy_code(source_code):
source_code: a Python source string containing a small legacy function.def refactor_legacy_code(source_code):