def _generate_var_name(prefix, field_name):
    """
    Generate the environment variable name, given a prefix
    and the configuration field name.

    Examples:

    >>> _generate_var_name("", "some_var")
    "SOME_VAR"
    >>> _generate_var_name("my_app", "some_var")
    "MY_APP_SOME_VAR"

    :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((prefix, field_name)).upper()
        if prefix
        else field_name.upper()
    )