Flag the given names to reset to their current value in the next Python.
    
    :param dict environ: The environment that will be passed to the next Python.
    :param names: A list of variable names that should be reset to their current
        value (as in ``environ``) when the next sub-Python starts.
    :param str label: A name for this environment freeze; the default of ``None``
        will be unfrozen at startup.
    
    This is useful to reset environment variables that are set by wrapper
    scripts that are nessesary to bootstrap the process, but we do not want to
    carry into any subprocess. E.g. ``LD_LIBRARY_PATH``.

    This may be called multiple times for the same label as it updates any
    existing freezes.
    
    Usage::
    
        import os
        from subprocess import call
        
        from sitecustomize.environ import freeze
        
        env = dict(os.environ)
        env['DEMO'] = 'one'
        freeze(env, ['DEMO'])
        env['DEMO'] = 'two'
        
        call(['python', '-c', 'import os; print os.environ["DEMO"]'], env=env)
        # Prints: one

def freeze(environ, names, label=None):
    """Flag the given names to reset to their current value in the next Python.
    
    :param dict environ: The environment that will be passed to the next Python.
    :param names: A list of variable names that should be reset to their current
        value (as in ``environ``) when the next sub-Python starts.
    :param str label: A name for this environment freeze; the default of ``None``
        will be unfrozen at startup.
    
    This is useful to reset environment variables that are set by wrapper
    scripts that are nessesary to bootstrap the process, but we do not want to
    carry into any subprocess. E.g. ``LD_LIBRARY_PATH``.

    This may be called multiple times for the same label as it updates any
    existing freezes.
    
    Usage::
    
        import os
        from subprocess import call
        
        from sitecustomize.environ import freeze
        
        env = dict(os.environ)
        env['DEMO'] = 'one'
        freeze(env, ['DEMO'])
        env['DEMO'] = 'two'
        
        call(['python', '-c', 'import os; print os.environ["DEMO"]'], env=env)
        # Prints: one
        
    """
    diff = _get_diff(environ, label)
    for name in names:
        diff[name] = environ.get(name)
    environ[_variable_name(label)] = _dumps(diff)