def mapping(dictionary, mapping):
    """
    takes in a dictionary and a mapping which contains new key names,
    and returns a new dictionary with the updated key names, i.e.:
    dictionary = {'a': 1, 'b': 2, 'c': 3}
    mapping = {'a': 'aa', 'c': 'cc'}
    mapped_dictionary = mapping(dictionary, mapping)
    mapped_dictionary = {'aa': 1, b, 2, 'cc': 3}
    """
    mapped_dictionary = {}
    for key, value in dictionary.items():
        if key in list(mapping.keys()):
            new_key = mapping[key]
            if new_key in mapped_dictionary:
                if hasattr(value, 'any'):
                    if not value.any():
                        continue
                    if hasattr(mapped_dictionary, 'any'):
                        if value.any() and not mapped_dictionary[new_key].any(
                            ):
                            mapped_dictionary[new_key] = value
                        elif value.any() and mapped_dictionary[new_key].any():
                            mapped_dictionary[new_key] = value
                    elif value.any() and not mapped_dictionary[new_key].any():
                        mapped_dictionary[new_key] = value
                    elif value.any() and mapped_dictionary[new_key].any():
                        mapped_dictionary[new_key] = value
                elif not value:
                    continue
                elif value and not mapped_dictionary[new_key]:
                    mapped_dictionary[new_key] = value
                elif value and mapped_dictionary[new_key]:
                    mapped_dictionary[new_key] = value
            else:
                mapped_dictionary[new_key] = value
        else:
            mapped_dictionary[key] = value
    return mapped_dictionary
