def _read_by_path(self, path, orgname=None):
        """
        Given a qualified path, find entry in directory and return DirEntry
        object or None if not found.
        A side effect is to clean any but the most recent entries found for this path.
        """
        if path is None:
            raise BadRequest("Illegal arguments")
        orgname = orgname or self.orgname
        parent, key = path.rsplit("/", 1)
        parent = parent or "/"
        find_key = [orgname, key, parent]
        view_res = self.dir_store.find_by_view('directory', 'by_key', key=find_key, id_only=True, convert_doc=True)

        match = [doc for docid, index, doc in view_res]
        if len(match) > 1:
            log.warn("More than one directory entry found for key %s" % path)
            recent_match = self._cleanup_outdated_entries(match, "path=%s" % path)
            return recent_match
        elif match:
            return match[0]
        return None
dataset/ETHPy150Open ooici/pyon/pyon/ion/directory.py/Directory._read_by_path/original