Maps a dict's keys to the provided models attributes using its attribute_map
    attribute. This is (always?) the same as converting camelCase to snake_case.
    Note that the function will not influence nested object's keys.

def _map_dict_keys_to_model_attributes(model_type, model_dict):
    """
    Maps a dict's keys to the provided models attributes using its attribute_map
    attribute. This is (always?) the same as converting camelCase to snake_case.
    Note that the function will not influence nested object's keys.
    """

    new_dict = {}
    for key, value in model_dict.items():
        new_dict[_get_k8s_model_attribute(model_type, key)] = value

    return new_dict