<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def choose_directory(self, line_edit, title):
 """ Show a directory selection dialog. This function will show the dialog then set line_edit widget text with output from the dialog. :param line_edit: Widget whose text should be updated. :type line_edit: QLineEdit :param title: title of dialog :type title: str, QString """

        path = line_edit.text()
        # noinspection PyCallByClass,PyTypeChecker
        new_path = QFileDialog.getExistingDirectory(
            self, title, path, QFileDialog.ShowDirsOnly)
        if new_path is not None and os.path.exists(new_path):
            line_edit.setText(new_path)