def METHOD_NAME(self, decorations):
    """
    Add text decorations on a CodeEditor instance.
    Don't add duplicated decorations, and order decorations according
    draw_order and the size of the selection.
    Args:
        decorations (sourcecode.api.TextDecoration) (could be a list)
    Returns:
        int: Amount of decorations added.
    """
    current_decorations = self._decorations["misc"]
    added = 0
    if isinstance(decorations, list):
        not_repeated = set(decorations) - set(current_decorations)
        current_decorations.extend(list(not_repeated))
        self._decorations["misc"] = current_decorations
        added = len(not_repeated)
    elif decorations not in current_decorations:
        self._decorations["misc"].append(decorations)
        added = 1
    if added > 0:
        self.update()
    return added