<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save(self):
 """This function is called by the parent dialog window when the user selects to save the settings."""

        if self.path is None:  # Delete requested, so remove the current path from sys.path, if present
            if self.config_manager.userCodeDir is not None:
                sys.path.remove(self.config_manager.userCodeDir)
                self.config_manager.userCodeDir = None
                logger.info("Removed custom module search path from configuration and sys.path.")

        else:
            if self.path != self.config_manager.userCodeDir:
                if self.config_manager.userCodeDir is not None:
                    sys.path.remove(self.config_manager.userCodeDir)
                sys.path.append(self.path)
                self.config_manager.userCodeDir = self.path
                logger.info("Saved custom module search path and added it to sys.path: {}".format(self.path))