def get_package_info(pkgs):
    """ get package versions for the passed required & optional packages.

    Using local imports to avoid import overhead on interpreter startup.
    """
    import importlib
    pversions = []
    for modname, ver_f in pkgs:
        try:
            mod = importlib.import_module(modname)
            ver = ver_f(mod)
            pversions.append((modname, ver))
        except Exception:
            pversions.append((modname, None))
    return pversions
