def valid_refined(candidate):
    """
    Utility function that determines if a passed permutation is valid.
    Specifically, there exists one and only one "pair" of matching digits.
    """
    permutation = str(candidate)
    for char in permutation[::-1]:
        if 2 == permutation.count(char):
            return True
    # didn't find a true condition
    return False