<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_rule_name(self, rule_name):
 """ Add the matched centralized sampling rule name if a segment is sampled because of that rule. This method should be only used by the recorder. """

        if not self.aws.get('xray', None):
            self.aws['xray'] = {}
        self.aws['xray']['sampling_rule_name'] = rule_name