def get_clean_config(config):
    """Get cleaned config from original config.

    :param config: configuration to be cleaned.

    :returns: clean configuration without key referring to None or empty dict.
    """
    if config is None:
        return None

    if isinstance(config, dict):
        extracted_config = {}
        for key, value in config.items():
            sub_config = get_clean_config(value)
            if sub_config is not None:
                extracted_config[key] = sub_config

        if not extracted_config:
            return None

        return extracted_config
    else:
        return config