import re


def fix_punct_spaces(string: str):
    """
    fix_punct_spaces - replace spaces around punctuation with punctuation. For example, "hello , there" -> "hello, there"

    Parameters
    ----------
    string : str, required, input string to be corrected

    Returns
    -------
    str, corrected string
    """

    fix_spaces = re.compile(r"\s*([?!.,]+(?:\s+[?!.,]+)*)\s*")
    string = fix_spaces.sub(lambda x: "{} ".format(x.group(1).replace(" ", "")), string)
    string = string.replace(" ' ", "'")
    string = string.replace(' " ', '"')
    string = string.replace("- _", "-")
    string = string.replace("_ -", "-")
    string = string.replace(" _ ", "-")
    string = string.replace("_ ", "-")
    string = string.strip("_")
    return string.strip()