<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_files(path):
 """Recursively collects a list of files at a path."""

    files = []
    if os.path.isdir(path):
        for stats in os.walk(path):
            for f in stats[2]:
                files.append(os.path.join(stats[0], f))
    elif os.path.isfile(path):
        files = [path]
    return files