def quoting_nsarg(nsarg_value):
    """Quoting nsargs

    If needs quotes (only if it contains whitespace, comma or ')' ), make sure
        it is quoted, else don't add them.


    """
    quoted = re.findall(r'^"(.*)"$', nsarg_value)

    if re.search(
        r"[),\s]", nsarg_value
    ):  # quote only if it contains whitespace, comma or ')'
        if quoted:
            return nsarg_value
        else:
            return f'"{nsarg_value}"'
    else:
        if quoted:
            return quoted[0]
        else:
            return nsarg_value
Quoting nsargs

    If needs quotes (only if it contains whitespace, comma or ')' ), make sure
        it is quoted, else don't add them.