code: def addMargin(self, margin, index=None):
          
          if index is None:
              self._margins.append(margin)
          else:
              self._margins.insert(index, margin)
          if margin.isVisible():
              self.updateViewport()
docs: Adds a new margin.
             index: index in the list of margins. Default: to the end of the list