import pkg_resources


def installed(*specifiers):
    """Returns True if the current environment satisfies the specified
    package requirement.

    Args:
        specifiers: Version specifiers (e.g., `numpy>=1.20.0`).
    """
    # Delay import of pkg_resources because it is excruciatingly slow.
    # See https://github.com/pypa/setuptools/issues/510

    for spec in specifiers:
        try:
            pkg_resources.require(spec)
        except pkg_resources.ResolutionError:
            return False
    return True