import string


def formatStr(bad_str, hard=True):
    """Remove trash punctuation.

        Args:
        -----
            bad_str (str): string to format
            hard (bool): remove all punctuation or just remove space

        Return:
        -------
            string formated
    """
    try:
        if hard:
            for char in string.punctuation + ' ':
                bad_str = bad_str.replace(char, '')

        return " ".join(bad_str.split()).lower()
    except Exception:
        # logger.log("Can't format {}".format(bad_str), logging.WARNING)
        return bad_str