<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install_visiting(self, path, visitor, prefix=None):
 """ Installs all the modules found in the given path if they are accepted by the visitor. The visitor must be a callable accepting 3 parameters: * fullname: The full name of the module * is_package: If True, the module is a package * module_path: The path to the module file :param path: Root search path :param visitor: The visiting callable :param prefix: (**internal**) Prefix for all found modules :return: A 2-tuple, with the list of installed bundles and the list of failed modules names :raise ValueError: Invalid path or visitor """

        # Validate the path
        if not path:
            raise ValueError("Empty path")
        elif not is_string(path):
            raise ValueError("Path must be a string")

        # Validate the visitor
        if visitor is None:
            raise ValueError("No visitor method given")

        # Use an absolute path
        path = os.path.abspath(path)
        if not os.path.exists(path):
            raise ValueError("Inexistent path: {0}".format(path))

        # Set up the prefix if needed
        if prefix is None:
            prefix = os.path.basename(path)

        bundles = set()
        failed = set()

        with self.__bundles_lock:
            # Walk through the folder to find modules
            for name, is_package in walk_modules(path):
                # Ignore '__main__' modules
                if name == "__main__":
                    continue

                # Compute the full name of the module
                fullname = ".".join((prefix, name)) if prefix else name
                try:
                    if visitor(fullname, is_package, path):
                        if is_package:
                            # Install the package
                            bundles.add(self.install_bundle(fullname, path))

                            # Visit the package
                            sub_path = os.path.join(path, name)
                            sub_bundles, sub_failed = self.install_visiting(
                                sub_path, visitor, fullname
                            )
                            bundles.update(sub_bundles)
                            failed.update(sub_failed)
                        else:
                            # Install the bundle
                            bundles.add(self.install_bundle(fullname, path))
                except BundleException as ex:
                    # Error loading the module
                    _logger.warning("Error visiting %s: %s", fullname, ex)

                    # Try the next module
                    failed.add(fullname)
                    continue

        return bundles, failed