Docker Desktop needs to display a filtered list of container states. Given container objects, keep containers whose status is allowed and whose cpu_percent meets a minimum threshold, then sort the remaining containers by multiple criteria.
Implement filter_and_sort_containers(containers, allowed_statuses, min_cpu_percent, sort_criteria). containers is a list of dictionaries containing id, status, cpu_percent, memory_mb, and created_at. allowed_statuses is a list of status strings. min_cpu_percent is a number. sort_criteria is a list of dictionaries ordered from highest to lowest priority, where each dictionary has a valid field and an order of either "asc" or "desc".
Return a new list containing containers whose status appears in allowed_statuses and whose CPU usage is at least min_cpu_percent. Apply every sort criterion, preserving the original order when all specified values tie. created_at values use ISO 8601 strings, so normal string comparison is valid.
def filter_and_sort_containers(containers, allowed_statuses, min_cpu_percent, sort_criteria):