<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hermetic_environment_as(**kwargs):
 """Set the environment to the supplied values from an empty state."""

  old_environment = os.environ.copy() if PY3 else _copy_and_decode_env(os.environ)
  _purge_env()
  try:
    with environment_as(**kwargs):
      yield
  finally:
    _purge_env()
    _restore_env(old_environment)