'Given a sequence of path strings, return the set of all paths that
can be reached from the initial set by following symlinks.
:param paths: sequence of path strings.
:return: a sequence of path strings that are all the unique paths that
can be reached from the given ones after following symlinks.'

def symlink_closure(self, paths):

    SCRIPT = "python    -c    'import    cPickle,    os,    sys\npaths    =    cPickle.load(sys.stdin)\nclosure    =    {}\nwhile    paths:\n                path    =    paths.keys()[0]\n                del    paths[path]\n                if    not    os.path.exists(path):\n                                continue\n                closure[path]    =    None\n                if    os.path.islink(path):\n                                link_to    =    os.path.join(os.path.dirname(path),\n                                                                                                                            os.readlink(path))\n                                if    link_to    not    in    closure.keys():\n                                                paths[link_to]    =    None\ncPickle.dump(closure.keys(),    sys.stdout,    0)'"
    input_data = cPickle.dumps(dict(((path, None) for path in paths)), 0)
    output = self.run(SCRIPT, stdout_tee=None, stdin=input_data, timeout=60).stdout
    return cPickle.loads(output)
