class_docstr: Context manager to handle optional dependencies
  
  It will catch any import errors occurring inside the with-clause and
  keep a reference to the error so it can be reraised latter on.
  
  Use import_optional.ensure() to verify the extra dependency is correctly installed,
  otherwise it will raise the previously caught ImportError.
  
  Parameters
  ----------
  package: str
      Name of the package (ex: algorithm or executor)
  extra_dependency: str, optional
      Name of the extra dependency to be installed.
      Will be used in the error string to guide installation of the
      extra package as ``pip install orion[extra_dependency]``.
      If not defined, will be ``package.lower()``
docstr: Raise the previously caught ImportError if the import failed.
code: def ensure(self) -> None:
      """Raise the previously caught ImportError if the import failed."""
      if self.failed:
          raise ImportError(
              f"The package `{self.package}` is not installed. Install it with "
              f"`pip install orion[{self.extra_dependency}]`."
          ) from self.import_error
  
file_path: orion/src/orion/core/utils/module_import.py
imports: from __future__ import annotations
  import os
label_desc: Use image node_id 5 for calling the ImportOptional obj's underlying member method code with example usage: obj.ensure() without return types