def METHOD_NAME(validPairs, invalidPairs, keypointsList):
    personwiseKeypoints = -1 * np.ones((0, 19))
    for k in range(len(mapIdx)):
        if k not in invalidPairs:
            partAs = validPairs[k][:, 0]
            partBs = validPairs[k][:, 1]
            indexA, indexB = np.array(POSE_PAIRS[k])
            for i in range(len(validPairs[k])):
                found = 0
                personIdx = -1
                for j in range(len(personwiseKeypoints)):
                    if personwiseKeypoints[j][indexA] == partAs[i]:
                        personIdx = j
                        found = 1
                        break
                if found:
                    personwiseKeypoints[personIdx][indexB] = partBs[i]
                    personwiseKeypoints[personIdx][-1] += keypointsList[partBs[i].astype(int), 2] + validPairs[k][i][
                        2]
                elif not found and k < 17:
                    row = -1 * np.ones(19)
                    row[indexA] = partAs[i]
                    row[indexB] = partBs[i]
                    row[-1] = sum(keypointsList[validPairs[k][i, :2].astype(int), 2]) + validPairs[k][i][2]
                    personwiseKeypoints = np.vstack([personwiseKeypoints, row])
    return personwiseKeypoints