<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_flag_record(self, state: str, feature_key: str) -> None: """Update redis record with new state. :param state: state for feature flag. :param feature_key: key for feature flag. """

        key_name = self._format_key_name()
        try:
            parsed_flag = json.loads(self.get_flag_record(feature_key).decode('utf-8'))
            parsed_flag['on'] = state
            parsed_flag['version'] += 1
            updated_flag = json.dumps(parsed_flag).encode('utf-8')
        except KeyError as ex:
            LOG.error(ex)
            sys.exit(1)

        LOG.info('updating %s to %s', feature_key, state)

        self.redis.hset(key_name, feature_key, updated_flag)