'Retrieve the address of an environment variable in the remote process.'

def getenv(self, variable, **kwargs):

    argv0 = self.argv[0]
    script = ';'.join(('from    ctypes    import    *', 'import    os', 'libc    =    CDLL("libc.so.6")', ('print    os.path.realpath(%r)' % self.executable), ('print(libc.getenv(%r))' % variable)))
    try:
        with context.local(log_level='error'):
            python = self.parent.which('python')
            if (not python):
                self.error('Python    is    not    installed    on    the    remote    system.')
            io = self.parent.process([argv0, '-c', script.strip()], executable=python, env=self.env, **kwargs)
            path = io.recvline()
            address = int(io.recvline())
            address -= len(python)
            address += len(path)
            return (int(address) & context.mask)
    except:
        self.exception(('Could    not    look    up    environment    variable    %r' % variable))
