<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_resources(self, resources):
 """Parses and sets resources in the model using a factory."""


        self.resources = {}
        resource_factory = ResourceFactory()
        for res_id, res_value in resources.items():
            r = resource_factory.create_resource(res_id, res_value)
            if r:
                if r.resource_type in self.resources:
                    self.resources[r.resource_type].append(r)
                else:
                    self.resources[r.resource_type] = [r]