def METHOD_NAME(clv):
    if not clv.csv_data:
        return
    # Old style codelists (i.e. those created with CSV data via the version_create view
    # /codelist/<org or user>/add/) are now required to contain a column named "code"
    # or "dmd_id".
    # However, older ones could be uploaded with any column names, so we need to
    # check the headers to identify the most likely one
    # These represent the valid case-insensitive code column names across all existing
    # old-syle codelists
    possible_columns_by_coding_system = {
        "dmd": {
            "code": ["code", "dmd_id", "id", "snomed_id", "dmd"],
            "term": ["term", "name", "dmd_name", "nm"],
            "type": ["dmd_type", "obj_type", "type"],
        },
        "snomedct": {
            "code": ["code", "id", "snomed_id", "snomedcode", "dmd_id"],
            "term": ["term", "name", "dmd_name"],
        },
        "icd10": {
            "code": ["code", "id", "icd code", "icd_code", "icd", "icd10_code"],
            "term": ["term", "description", "diag_desc"],
        },
        "ctv3": {
            "code": ["code", "ctv3id", "ctv3code", "ctv3_id"],
            "term": [
                "term",
                "ctv3preferredtermdesc",
                "ctv3_description",
                "ctv3_description",
                "ctvterm",
                "readterm",
                "ctvterm",
            ],
        },
        "default": {"code": ["code"], "term": ["term"]},
    }
    headers, *rows = clv.table
    headers = [header.lower().strip() for header in headers]
    possible_columns = possible_columns_by_coding_system.get(
        clv.codelist.coding_system_id, "default"
    )
    def _get_col_ix(col_type):
        column = next(
            (col for col in possible_columns.get(col_type, []) if col in headers), None
        )
        if column:
            return headers.index(column)
    code_ix = _get_col_ix("code")
    if code_ix is None:
        return
    term_ix = _get_col_ix("term")
    type_ix = _get_col_ix("type")
    def get_term(row):
        if term_ix is None:
            return
        term = row[term_ix]
        if type_ix is not None:
            term = f"{term} ({row[type_ix]})"
        return term
    return {row[code_ix]: get_term(row) for row in rows}