def __enter__(self):
        """Enters the context and returns self if the link could be created. 
        
        If the link could not be created because the source path did not 
        exist ``None`` is returned.
        """
        if self.stable_path:
            return self.stable_path
        
        _, file_name = os.path.split(self._source_path)
        stable_dir = tempfile.mkdtemp(prefix="%s-" % file_name)
        assert self._source_path.startswith("/")
        stable_path = os.path.join(stable_dir, self._source_path[1:])
        
        self.log.debug("Linking %s to point to %s", stable_path, 
            self._source_path)
        ensure_dir(os.path.dirname(stable_path))
        try:
            os.link(self._source_path, stable_path)
        except (EnvironmentError) as e:
            if e.errno == errno.ENOENT:
                return None
            raise
        
        self._stable_dir = stable_dir
        self.stable_path = stable_path
        return self
dataset/ETHPy150Open amorton/cassback/cassback/file_util.py/FileReferenceContext.__enter__/original