def GetProcessEnv(pid=1):
    """the environment settings from the processes perpective,
       @return C{dict}
    """

    env = {}
    try:
        envlist = open('/proc/%s/environ' % pid).read().split('\000')
    except:
        return env
    for e in envlist:
        (k, _, v) = e.partition('=')
        (k, v) = (k.strip(), v.strip())
        if not k:
            continue
        env[k] = v
    return env
dataset/ETHPy150Open cloudviz/agentless-system-crawler/crawler/misc.py/GetProcessEnv/original