<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mpl_weight2qt(weight):
 """Convert a weight from matplotlib definition to a Qt weight Parameters weight: int or string Either an integer between 1 and 1000 or a string out of :attr:`weights_mpl2qt` Returns ------- int One type of the PyQt5.QtGui.QFont.Weight"""

    try:
        weight = weights_mpl2qt[weight]
    except KeyError:
        try:
            weight = float(weight) / 10
        except (ValueError, TypeError):
            weight = QtGui.QFont.Normal
        else:
            try:
                weight = min(filter(lambda w: w >= weight, weights_qt2mpl),
                             key=lambda w: abs(w - weight))
            except ValueError:
                weight = QtGui.QFont.Normal
    return weight