def METHOD_NAME(key, value, verbose=True):
    """
    put key in the environment with value
    tracks added keys until write_changes has been called
    :param verbose: include message in dry run output for defining this environment variable
    """
    if key in os.environ:
        oldval_info = "previous value: '%s'" % os.environ[key]
    else:
        oldval_info = "previously undefined"
    # os.putenv() is not necessary. os.environ will call this.
    os.environ[key] = value
    _changes[key] = value
    _log.info("Environment variable %s set to %s (%s)", key, value, oldval_info)
    if verbose and build_option('extended_dry_run'):
        quoted_value = shell_quote(value)
        if quoted_value[0] not in ['"', "'"]:
            quoted_value = '"%s"' % quoted_value
        dry_run_msg("  export %s=%s" % (key, quoted_value), silent=build_option('silent'))