<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def normalize_env(env, keys, force=False):
 """Given a dictionary representing a shell environment, add the variables from os.environ needed for the processing of .bat files; the keys are controlled by the keys argument. It also makes sure the environment values are correctly encoded. If force=True, then all of the key values that exist are copied into the returned dictionary. If force=false, values are only copied if the key does not already exist in the copied dictionary. Note: the environment is copied."""

    normenv = {}
    if env:
        for k in list(env.keys()):
            normenv[k] = copy.deepcopy(env[k])

        for k in keys:
            if k in os.environ and (force or not k in normenv):
                normenv[k] = os.environ[k]

    # This shouldn't be necessary, since the default environment should include system32,
    # but keep this here to be safe, since it's needed to find reg.exe which the MSVC
    # bat scripts use.
    sys32_dir = os.path.join(os.environ.get("SystemRoot",
                                            os.environ.get("windir", r"C:\Windows\system32")),
                             "System32")

    if sys32_dir not in normenv['PATH']:
        normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_dir

    # Without Wbem in PATH, vcvarsall.bat has a "'wmic' is not recognized"
    # error starting with Visual Studio 2017, although the script still
    # seems to work anyway.
    sys32_wbem_dir = os.path.join(sys32_dir, 'Wbem')
    if sys32_wbem_dir not in normenv['PATH']:
        normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_wbem_dir

    debug("PATH: %s"%normenv['PATH'])

    return normenv