def get_magicc7_to_openscm_variable_mapping(inverse=False):
def get_openscm_replacement(in_var):<EOL><INDENT>if in_var.endswith("<STR_LIT>"):<EOL><INDENT>prefix = "<STR_LIT>"<EOL><DEDENT>elif in_var.endswith("<STR_LIT>"):<EOL><INDENT>prefix = "<STR_LIT>"<EOL><DEDENT>elif in_var.endswith("<STR_LIT>"):<EOL><INDENT>prefix = "<STR_LIT>"<EOL><DEDENT>elif in_var.endswith("<STR_LIT>"):<EOL><INDENT>prefix = "<STR_LIT>"<EOL><DEDENT>elif in_var.endswith("<STR_LIT>"):<EOL><INDENT>prefix = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>variable = in_var.split("<STR_LIT:_>")[<NUM_LIT:0>]<EOL>if variable.endswith("<STR_LIT>"):<EOL><INDENT>variable = variable.replace("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in variable:<EOL><INDENT>variable = variable.replace("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in variable:<EOL><INDENT>variable = variable.replace("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in variable:<EOL><INDENT>variable = variable.replace("<STR_LIT>", "<STR_LIT>")<EOL><DEDENT>aggregate_indicators = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL>for agg_indicator, long_name in aggregate_indicators.items():<EOL><INDENT>if variable.startswith(agg_indicator):<EOL><INDENT>stripped_var = variable.replace(agg_indicator, "<STR_LIT>")<EOL>if stripped_var:<EOL><INDENT>variable = DATA_HIERARCHY_SEPARATOR.join([stripped_var, long_name])<EOL><DEDENT>else:<EOL><INDENT>variable = long_name<EOL><DEDENT><DEDENT><DEDENT>edge_case_B = variable.upper() in ("<STR_LIT>", "<STR_LIT>")<EOL>if variable.endswith("<STR_LIT:I>"):<EOL><INDENT>variable = DATA_HIERARCHY_SEPARATOR.join(<EOL>[variable[:-<NUM_LIT:1>], "<STR_LIT>"]<EOL>)<EOL><DEDENT>elif variable.endswith("<STR_LIT:B>") and not edge_case_B:<EOL><INDENT>variable = DATA_HIERARCHY_SEPARATOR.join([variable[:-<NUM_LIT:1>], "<STR_LIT>"])<EOL><DEDENT>case_adjustments = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL>variable = apply_string_substitutions(variable, case_adjustments)<EOL>return DATA_HIERARCHY_SEPARATOR.join([prefix, variable])<EOL><DEDENT>magicc7_suffixes = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>magicc7_base_vars = MAGICC7_EMISSIONS_UNITS.magicc_variable.tolist() + [<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>]<EOL>magicc7_vars = [<EOL>base_var + suffix<EOL>for base_var in magicc7_base_vars<EOL>for suffix in magicc7_suffixes<EOL>]<EOL>replacements = {m7v: get_openscm_replacement(m7v) for m7v in magicc7_vars}<EOL>replacements.update(<EOL>{<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",  <EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL>)<EOL>agg_ocean_heat_top = "<STR_LIT>"<EOL>heat_content_aggreg_depths = {<EOL>"<STR_LIT>".format(i): "<STR_LIT>".format(<EOL>agg_ocean_heat_top, DATA_HIERARCHY_SEPARATOR, i<EOL>)<EOL>for i in range(<NUM_LIT:1>, <NUM_LIT:4>)<EOL>}<EOL>replacements.update(heat_content_aggreg_depths)<EOL>replacements.update({"<STR_LIT>": agg_ocean_heat_top})<EOL>ocean_temp_layer = {<EOL>"<STR_LIT>".format(i): "<STR_LIT>".format(<EOL>DATA_HIERARCHY_SEPARATOR, i<EOL>)<EOL>for i in range(<NUM_LIT:1>, <NUM_LIT>)<EOL>}<EOL>replacements.update(ocean_temp_layer)<EOL>if inverse:<EOL><INDENT>return {v: k for k, v in replacements.items()}<EOL><DEDENT>else:<EOL><INDENT>return replacements<EOL><DEDENT>
Get the mappings from MAGICC7 to OpenSCM variables.

    Parameters
    ----------
    inverse : bool
        If True, return the inverse mappings i.e. OpenSCM to MAGICC7 mappings

    Returns
    -------
    dict
        Dictionary of mappings