Given a list of log lines logs and a target severity string level, return all error codes that appear in lines matching that severity. A valid code appears as CODE=<value> where <value> consists of uppercase letters, digits, or underscores. Return each matching code once, in the order it is first found.
def extract_error_codes(logs, level):