code: def check_item_type_uniqueness(tag, previous_tags):
      
      fail = False
      #If the tag is being created...
      if not tag.id:
          #... and the new item type is different from previous item types (for
          #example, different from the first of them), fail
          fail = previous_tags and tag.item_type != previous_tags[0].item_type
      #If the tag is being modifying...
      else:
          #... but there is only one previous tag (the one that is being
          #modifying), do not fail
          fail = previous_tags.count() > 1 and \
                 tag.item_type != previous_tags[0].item_type
      return fail
docs: Check the uniqueness of the 'item type' for an object.