def quote_sheetname(sheetname):
    """
    Convert a worksheet name to a quoted  name if it contains spaces or
    special characters.

    Args:
       sheetname: The worksheet name. String.

    Returns:
        A quoted worksheet string.

    """
    if not sheetname.isalnum() and not sheetname.startswith("'"):
        sheetname = sheetname.replace("'", "''")
        sheetname = "'%s'" % sheetname
    return sheetname
