def _use_proc_maps(name):
        """
        Find so from /proc/pid/maps
        Only works with libraries that has already been loaded.
        But this is the most accurate method -- it finds the exact library that's being used.
        """
        procmap = os.path.join('/proc', str(os.getpid()), 'maps')
        if not os.path.isfile(procmap):
            return None
        try:
            with open(procmap, 'r') as f:
                for line in f:
                    line = line.strip().split(' ')
                    sofile = line[-1]

                    basename = os.path.basename(sofile)
                    if 'lib' + name + '.so' in basename:
                        if os.path.isfile(sofile):
                            return os.path.realpath(sofile)
        except IOError:
            # can fail in certain environment (e.g. chroot)
            # if the pids are incorrectly mapped
            pass

        Find so from /proc/pid/maps
        Only works with libraries that has already been loaded.
        But this is the most accurate method -- it finds the exact library that's being used.
        
tensorpack/utils/utils.py