<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_fw_dict(self):
 """This API creates a FW dictionary from the local attributes. """

        fw_dict = {}
        if self.fw_id is None:
            return fw_dict
        fw_dict = {'rules': {}, 'tenant_name': self.tenant_name,
                   'tenant_id': self.tenant_id, 'fw_id': self.fw_id,
                   'fw_name': self.fw_name,
                   'firewall_policy_id': self.active_pol_id,
                   'fw_type': self.fw_type, 'router_id': self.router_id}
        # When Firewall and Policy are both deleted and the SM is doing a
        # retry (maybe DCNM Out partition could not be deleted) during
        # which without this check, it throws an exception since
        # self.policies is empty. This is also an issue during restart.
        if self.active_pol_id not in self.policies:
            return fw_dict
        pol_dict = self.policies[self.active_pol_id]
        for rule in pol_dict['rule_dict']:
            fw_dict['rules'][rule] = self.rules[rule]
        return fw_dict