<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_py_tree(self, pytree):
 """Parse the given Python package tree. :param str pytree: The absolute path to the Python tree which is to be parsed. :rtype: dict :returns: A two-tuple. The first element is a dict where each key is the path of a parsed Python module (relative to the Python tree) and its value is the expected rst module name. The second element is a set where each element is a Python package or sub-package. :rtype: tuple """

        parsed_pytree = {}
        pypackages = set()
        for base, dirs, files in os.walk(pytree):
            if self._ignore_pydir(os.path.basename(base)):
                continue

            # TODO(Anthony): If this is being run against a Python 3 package, this needs to be
            # adapted to account for namespace packages.
            elif '__init__.py' not in files:
                continue

            package_basename = self.build_pypackage_basename(pytree=pytree, base=base)
            pypackages.add(package_basename)

            for filename in files:
                if self._ignore_pyfile(filename):
                    continue

                parsed_path = os.path.join(package_basename, filename)
                parsed_pytree[parsed_path] = self.build_rst_name_from_pypath(parsed_path)

        return parsed_pytree, pypackages