def METHOD_NAME():
    # Try to use a required package - raise error
    with pytest.raises(RuntimeError):
        package_check(FAKE_NAME)
    # Optional, log.warn
    package_check(FAKE_NAME, optional=True)
    # Can also pass a string
    package_check(FAKE_NAME, optional='some-package')
    try:
        # Make a package
        sys.modules[FAKE_NAME] = FAKE_MODULE
        # Now it passes if we don't check the version
        package_check(FAKE_NAME)
        # A fake version
        FAKE_MODULE.__version__ = '0.2'
        package_check(FAKE_NAME, version='0.2')
        # fails when version not good enough
        with pytest.raises(RuntimeError):
            package_check(FAKE_NAME, '0.3')
        # Unless optional in which case log.warns
        package_check(FAKE_NAME, version='0.3', optional=True)
        # Might do custom version check
        package_check(FAKE_NAME, version='0.2', version_getter=lambda x: '0.2')
    finally:
        del sys.modules[FAKE_NAME]