code: def fontWeightIndex(qFont, weights):
      
      try:
          return weights.index(qFont.weight())
      except ValueError:
          if False and DEBUGGING:
              raise
          else:
              logger.warn("{} not found in font weights, using normal.".format(qFont.weight()))
              return weights.index(QtGui.QFont.Normal)
docs: Searches the index of qFont.family in the weight list.
          If qFont.weight() is not in the list, the index of QFont.Normal is returned.
          If that is also not present an error is raised.