def _get_book_and_sheet(app, sheet_name):
    """
    return a workbook and sheet object from a named sheet,
    e.g. "[Book1]Sheet1"

    If no book is specified in the name the active book is used.
    """    
    # split the sheet name into the workbook name and sheet name
    # e.g. "[Book1]Sheet1"
    match = re.match("^(?:\[(.*)\])?(.*)$", sheet_name)            
    if not match:
        raise AssertionError(sheet_name % "Error parsing sheet name '%s'")

    workbook_name, sheet_name = match.groups()
    if workbook_name is None:
        wb = app.ActiveWorkbook
    else:
        try:
            wb = app.Workbooks(workbook_name)
        except pywintypes.com_error:
            raise RuntimeError("Workbook '%s' not found" % workbook_name)

    try:
        sheet = wb.Sheets(sheet_name)
    except pywintypes.com_error:
        raise RuntimeError("Worksheet '%s' not found" % sheet_name)

    return wb, sheet
dataset/ETHPy150Open manahl/mdf/mdf/viewer/excel.py/_get_book_and_sheet/swapped operands of `%`