code: def createIconFromSvg(self, svg, color=None, colorsToBeReplaced=None):
          
          if colorsToBeReplaced is None:
              colorsToBeReplaced = self.colorsToBeReplaced
  
          if color:
              for oldColor in colorsToBeReplaced:
                  svg = svg.replace(oldColor, color)
  
          # From http://stackoverflow.com/questions/15123544/change-the-color-of-an-svg-in-qt
          qByteArray = QtCore.QByteArray()
          qByteArray.append(svg)
          svgRenderer = QtSvg.QSvgRenderer(qByteArray)
          icon = QtGui.QIcon()
          for size in self.renderSizes:
              pixMap = QtGui.QPixmap(QtCore.QSize(size, size))
              pixMap.fill(Qt.transparent)
              pixPainter = QtGui.QPainter(pixMap)
              pixPainter.setRenderHint(QtGui.QPainter.TextAntialiasing, True)
              pixPainter.setRenderHint(QtGui.QPainter.Antialiasing, True)
              svgRenderer.render(pixPainter)
              pixPainter.end()
              icon.addPixmap(pixMap)
  
          return icon
docs: Creates a QIcon given an SVG string.
  
              Optionally replaces the colors in colorsToBeReplaced by color.
  
              :param svg: string containing Scalable Vector Graphics XML
              :param color: '#RRGGBB' string (e.g. '#FF0000' for red)
              :param colorsToBeReplaced: optional list of colors to be replaced by color
                  If None, it will be set to the fill colors of the snip-icon libary
              :return: QtGui.QIcon