Write a Python script to backup all files older than 30 days from a directory.
Asked in the Technical stage.
For deterministic grading, implement backup_old_files(directory, backup_directory, now). directory and backup_directory are dictionaries mapping names to metadata dictionaries with type, mtime, and optional content. Copy qualifying file metadata into backup_directory and return qualifying filenames in sorted order. A file is eligible only when mtime < now - 30 * 24 * 60 * 60; directories and files exactly at the cutoff are excluded.
def backup_old_files(directory, backup_directory, now):