code: def manage_conflict(self, item, name):
          
          if item.is_tpl():
              existing = self.name_to_template[name]
          else:
              existing = self.name_to_item[name]
          if existing == item:
              return item
  
          existing_prio = getattr(
              existing,
              "definition_order",
              existing.properties["definition_order"].default)
          item_prio = getattr(
              item,
              "definition_order",
              item.properties["definition_order"].default)
          if existing_prio < item_prio:
              # Existing item has lower priority, so it has precedence.
              return existing
          if existing_prio > item_prio:
              # New item has lower priority, so it has precedence.
              # Existing item will be deleted below
              pass
          else:
              # Don't know which one to keep, lastly defined has precedence
              objcls = getattr(self.inner_class, "my_type", "[unknown]")
              mesg = "duplicate %s '%s', from: '%s' and '%s', using lastly defined. " \
                     "You may manually set the definition_order parameter to avoid this message." \
                     % (objcls, name, item.imported_from, existing.imported_from)
              item.configuration_warnings.append(mesg)
          if item.is_tpl():
              self.remove_template(existing)
          else:
              self.remove_item(existing)
          return item
docs: Checks if an object holding the same name already exists in the index.
  
          If so, it compares their definition order: the lowest definition order
          is kept. If definition order equal, an error is risen.Item
  
          The method returns the item that should be added after it has decided
          which one should be kept.
  
          If the new item has precedence over the New existing one, the
          existing is removed for the new to replace it.
  
          :param item: object to check for conflict
          :type item: alignak.objects.item.Item
          :param name: name of the object
          :type name: str
          :return: 'item' parameter modified
          :rtype: object