def getConstraintWeightAttr(leader, constraint):
    """
    Return the weight attribute from a constraint that
    corresponds to a specific leader node.

    Args:
        leader (PyNode): A node that is one of the leaders of a constraint
        constraint (PyNode): A constraint node
    """
    for i, target in enumerate(constraint.getTargetList()):
        if leader == target:
            return constraint.getWeightAliasList()[i]