def needs_quote(arg):
    """Return True if the given string needs to be shell-quoted.

    Quoting is need if any of the following are found:
     * a double quotation mark (")
     * a single quotation mark (')
     * whitespace
    """
    for c in arg:
        if c in ('"', "'"):
            return True
        if c.isspace():
            return True
    else:
        return False