code: def add(self, logical_id, deployment_preference_dict):
          
          if logical_id in self._resource_preferences:
              raise ValueError("logical_id {logical_id} previously added to this deployment_preference_collection".format(
                  logical_id=logical_id))
  
          self._resource_preferences[logical_id] = DeploymentPreference.from_dict(logical_id, deployment_preference_dict)
docs: Add this deployment preference to the collection
  
          :raise ValueError if an existing logical id already exists in the _resource_preferences
          :param logical_id: logical id of the resource where this deployment preference applies
          :param deployment_preference_dict: the input SAM template deployment preference mapping