def clip_candidates(a, b, numCandidates):
    """
    Clip retrieved candidates to numCandidates or, in case
    one method retrieived a smaller list than numCandidates,
    clip retrieved candidates to the same number as the smaller
    list.
    """
    a = a[:numCandidates]
    b = b[:numCandidates]
    if len(b) <= len(a):
        a = a[:len(b)]
    return a