def is_compat(major_ver=1):
    import openpyxl
    ver = LooseVersion(openpyxl.__version__)
    if major_ver == 1:
        return LooseVersion(start_ver) <= ver < LooseVersion(stop_ver)
    elif major_ver == 2:
        return LooseVersion(stop_ver) <= ver
    else:
        raise ValueError('cannot test for openpyxl compatibility with ver {0}'
                         .format(major_ver))
Detect whether the installed version of openpyxl is supported
dataset/ETHPy150Open pydata/pandas/pandas/compat/openpyxl_compat.py/is_compat