Given a list of log entries as strings, write a function that extracts every error code and returns a formatted summary of code frequencies. A valid error code appears either as ERROR_<digits> anywhere in the line or inside a JSON fragment as "error_code":"ERROR_<digits>". Return a list of strings formatted as "ERROR_404: 3", sorted by descending frequency and then lexicographically by code.
ERROR_<digits>def summarize_error_codes(logs):