Write a script to parse log files and identify the top 10 IP addresses making failed requests.
Implement top_failed_ips(log_lines). Each line uses combined-log format: IP - - [timestamp] "METHOD path protocol" STATUS bytes; status codes from 400 through 599 are failures. Return up to 10 [ip, count] pairs, ordered by descending failure count and then ascending IP address. Inputs contain valid log lines.
def top_failed_ips(log_lines):