is_palindrome function that ignores whitespace and punctuation
You are unnecessarily importing punctuation
Avoid reassigning module names such as string in your code
A list comprehension would be a simpler way of filtering out the data you don't want




from string import ascii_letters

def is_palindrome(candidate):
    """
    Returns True if candidate is a palindrome, ignoring whitespaces and punctuation.
    """
    stripped = [char.lower() for char in candidate if char in ascii_letters]
    return stripped == stripped[::-1]