def importorskip(modname, minversion=None):
    """ return imported module if it has at least "minversion" as its
    __version__ attribute.  If no minversion is specified the a skip
    is only triggered if the module can not be imported.
    """
    __tracebackhide__ = True
    compile(modname, '', 'eval') # to catch syntaxerrors
    try:
        __import__(modname)
    except __HOLE__:
        skip("could not import %r" %(modname,))
    mod = sys.modules[modname]
    if minversion is None:
        return mod
    verattr = getattr(mod, '__version__', None)
    if minversion is not None:
        try:
            from pkg_resources import parse_version as pv
        except ImportError:
            skip("we have a required version for %r but can not import "
                 "no pkg_resources to parse version strings." %(modname,))
        if verattr is None or pv(verattr) < pv(minversion):
            skip("module %r has __version__ %r, required is: %r" %(
                 modname, verattr, minversion))
    return mod
dataset/ETHPy150Open pytest-dev/pytest/_pytest/runner.py/importorskip