<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_available_engine_upgrades(client, major=False):
 """Returns all extant rds engine upgrades. As a nested mapping of engine type to known versions and their upgrades. Defaults to minor upgrades, but configurable to major. Example:: { 'oracle-se2': {'12.1.0.2.v2': '12.1.0.2.v5', '12.1.0.2.v3': '12.1.0.2.v5'}, 'postgres': {'9.3.1': '9.3.14', '9.3.10': '9.3.14', '9.3.12': '9.3.14', '9.3.2': '9.3.14'} } """

    results = {}
    engine_versions = client.describe_db_engine_versions()['DBEngineVersions']
    for v in engine_versions:
        if not v['Engine'] in results:
            results[v['Engine']] = {}
        if 'ValidUpgradeTarget' not in v or len(v['ValidUpgradeTarget']) == 0:
            continue
        for t in v['ValidUpgradeTarget']:
            if not major and t['IsMajorVersionUpgrade']:
                continue
            if LooseVersion(t['EngineVersion']) > LooseVersion(
                    results[v['Engine']].get(v['EngineVersion'], '0.0.0')):
                results[v['Engine']][v['EngineVersion']] = t['EngineVersion']
    return results