def _translate_header_entities_concepts(ingredient, dictionary, duplicated):
    """Translating entities or concepts

    Entities and concepts only have one dataframe inside the ingredient, so renaming will
    happen in the dataframe columns.

    Note that it's not allowed to translate reversed keyword `concept`/`concept_type`
    """
    data = ingredient.get_data()
    new_data = dict()
    if 'concept' in dictionary and ingredient.dtype == 'concepts':
        raise ValueError('cannot translate the primaryKey for concept!')
    for k in list(data.keys()):
        df_new = data[k].copy()
        for old_name, new_name in dictionary.items():
            if new_name in df_new.columns:
                if duplicated == 'error':
                    raise ValueError(
                        'can not rename column {} to {} because {} already exists!'
                        .format(old_name, new_name, new_name))
                elif duplicated == 'replace':
                    df_new[new_name] = df_new[old_name]
                    df_new = df_new.drop(old_name, axis=1)
                else:
                    raise ValueError('unknown option to `duplicated`: {}'.
                        format(duplicated))
            elif old_name in df_new.columns:
                df_new[new_name] = df_new[old_name]
                df_new = df_new.drop(old_name, axis=1)
            else:
                continue
        if ingredient.dtype == 'entities':
            rm_ = {}
            for c in df_new.columns:
                if c.startswith('is--'):
                    old_name_is_header = c[4:]
                    if old_name_is_header in dictionary:
                        rm_[c] = 'is--' + dictionary[old_name_is_header]
            if len(rm_) > 0:
                df_new = df_new.rename(columns=rm_)
        if k in dictionary.keys():
            new_data[dictionary[k]] = df_new
        else:
            new_data[k] = df_new
    return new_data
