def de_punc(s, punc=None, no_spaces=True, char='_'):
    """Remove punctuation and/or spaces in strings and replace with
    underscores or nothing

    Parameters
    ----------
    s : string
        input string to parse
    punc : string
        A string of characters to replace ie. '@ "!\'\\[]'
    no_spaces : boolean
        True, replaces spaces with underscore.  False, leaves spaces
    char : string
        Replacement character
    """
    if (punc is None) or not isinstance(punc, str):
        punc = '!"#$%&\'()*+,-./:;<=>?@[\\]^`{|}~'  # _ removed
    if no_spaces:
        punc = " " + punc
    s = "".join([[i, char][i in punc] for i in s])
    return s