def process_str_for_similarity_cmp(input_str, normalized=False, ignore_list=[]
    ):
    """ Processes string for similarity comparisons , cleans special characters and extra whitespaces
        if normalized is True and removes the substrings which are in ignore_list)
    Args:
        input_str (str) : input string to be processed
        normalized (bool) : if True , method removes special characters and extra whitespace from string,
                            and converts to lowercase
        ignore_list (list) : the substrings which need to be removed from the input string
    Returns:
       str : returns processed string
    """
for ignore_str in ignore_list:
    input_str = re.sub('{0}'.format(ignore_str), '', input_str, flags=re.
        IGNORECASE)
if normalized is True:
    input_str = input_str.strip().lower()
input_str = re.sub('\\W', '', input_str).strip()
Fuzzy string matching in Python