<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_doc_tree(self, doctree, pypackages):
 """Parse the given documentation tree. :param str doctree: The absolute path to the documentation tree which is to be parsed. :param set pypackages: A set of all Python packages found in the pytree. :rtype: dict :returns: A dict where each key is the path of an expected Python module and its value is the parsed rst module name (relative to the documentation tree). """

        parsed_doctree = {}
        for filename in os.listdir(doctree):
            if self._ignore_docfile(filename):
                continue

            expected_pyfile = self.build_pyfile_path_from_docname(filename)
            parsed_doctree[expected_pyfile] = filename

        pypackages = {name + '.py' for name in pypackages}
        return {elem: parsed_doctree[elem] for elem in parsed_doctree if elem not in pypackages}