import re


def deal_with_punctuation(text: str = '',
                          punctuation_to_collapse_by: str = '',
                          punctuation_to_explode_by: str = '') -> str:
    """
    Removes punctuation from a string
    :param text: original text
    :param punctuation_to_collapse_by: punctuation marks to strip
    :param punctuation_to_explode_by: punctuation marks to replace with spaces
    :return: cleaned text
    """
    new_text: str = text
    # Prioritise exploding first, these are punctuation marks that the user sets
    if punctuation_to_explode_by:
        pattern_to_explode_by = re.escape(punctuation_to_explode_by)
        new_text = re.sub(rf"[{pattern_to_explode_by}]", " ", new_text)
    # Then strip the rest
    if punctuation_to_collapse_by:
        pattern_to_collapse_by = re.escape(punctuation_to_collapse_by)
        new_text = re.sub(rf"[{pattern_to_collapse_by}]", "", new_text)
    return new_text