<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def take_quality_screenshot(self, screenshot_name):
 """Take a quality screenshot Use the screenshot_name args when you want to take a screenshot for reference Args: screenshot_name (str) the name of the screenshot """

        self.info_log("Taking a quality screenshot...")

        if self.test_instance._runner_dir:
            _screenshot_name = '%s.png' % string_to_filename(screenshot_name)
            relative_path = os.path.join(
                    self.test_instance._quality_screenshot_relative_dir,
                    _screenshot_name
                )

            full_path = os.path.join(
                    self.test_instance._quality_screenshot_dir,
                    _screenshot_name
                )
            self._driver.save_screenshot(
                full_path
            )

            with DbSessionContext(BROME_CONFIG['database']['mongo_database_name']) as session:  # noqa
                capabilities = {
                    'browserName': self.capabilities['browserName'],
                    'platform': self.capabilities['platform'],
                    'version': self.capabilities['version']
                }
                quality_screenshot = Testqualityscreenshot()
                quality_screenshot.timestamp = utcnow()
                quality_screenshot.browser_capabilities = capabilities
                quality_screenshot.browser_id = self.get_id()
                quality_screenshot.file_path = relative_path
                # TODO support s3
                quality_screenshot.location = 'local_file_system'
                quality_screenshot.root_path = self.test_instance._runner.root_test_result_dir  # noqa
                quality_screenshot.extra_data = {}
                quality_screenshot.title = screenshot_name
                quality_screenshot.test_instance_id = self.test_instance._test_instance_id  # noqa
                quality_screenshot.test_batch_id = self.test_instance._test_batch_id  # noqa

                session.save(quality_screenshot, safe=True)

            self.debug_log("Quality screenshot taken (%s)" % full_path)