def _generate_new_prefix(current_prefix, class_name):
    """
    Generate the new prefix to be used when handling nested configurations.

    Examples:

    >>> _generate_new_prefix("", "config_group_1")
    "CONFIG_GROUP_1"
    >>> _generate_new_prefix("my_app", "another_config_group")
    "MY_APP_ANOTHER_CONFIG_GROUP"

    :param prefix: the prefix to be used, can be empty
    :param field_name: the name of the field from which the variable is derived
    """
    return (
        "_".join((current_prefix, class_name)).upper()
        if current_prefix
        else class_name.upper()
    )