code: def addable(Class, parent, set=None, raiseexceptions=True):
          
  
  
          if not parent.__class__.accepts(Class, raiseexceptions, parent):
              return False
  
          if Class.OCCURRENCES > 0:
              #check if the parent doesn't have too many already
              count = parent.count(Class,None,True,[True, AbstractStructureElement]) #never descend into embedded structure annotatioton
              if count >= Class.OCCURRENCES:
                  if raiseexceptions:
                      if parent.id:
                          extra = ' (id=' + parent.id + ')'
                      else:
                          extra = ''
                      raise DuplicateAnnotationError("Unable to add another object of type " + Class.__name__ + " to " + parent.__class__.__name__ + " " + extra + ". There are already " + str(count) + " instances of this class, which is the maximum.")
                  else:
                      return False
  
          if Class.OCCURRENCES_PER_SET > 0 and set and Class.REQUIRED_ATTRIBS and Attrib.CLASS in Class.REQUIRED_ATTRIBS:
              count = parent.count(Class,set,True, [True, AbstractStructureElement])
              if count >= Class.OCCURRENCES_PER_SET:
                  if raiseexceptions:
                      if parent.id:
                          extra = ' (id=' + parent.id + ')'
                      else:
                          extra = ''
                      raise DuplicateAnnotationError("Unable to add another object of set " + set + " and type " + Class.__name__ + " to " + parent.__class__.__name__ + " " + extra + ". There are already " + str(count) + " instances of this class, which is the maximum for the set.")
                  else:
                      return False
  
  
  
          return True
docs: Tests whether a new element of this class can be added to the parent.
  
          This method is mostly for internal use.
          This will use the ``OCCURRENCES`` property, but may be overidden by subclasses for more customised behaviour.
  
          Parameters:
              parent (:class:`AbstractElement`): The element that is being added to
              set (str or None): The set
              raiseexceptions (bool): Raise an exception if the element can't be added?
  
          Returns:
              bool
  
          Raises:
              ValueError