from typing import Any
from typing import Type


def _is_measurement_device(instrument_handle: Any, class_type: Type) -> bool:
    """ Returns True if the instrument handle is of the given type, else False.

        This function checks whether the given handle is of the correct instrument type.
        All error's are catched related to importing of not installed drivers or instruments
        which are not connected.

        Args:
            instrument_handle: An measurement device instance.
            class_type: The type of the measurement class.

        Returns:
            True if of the given class_type, else False.
    """
    try:
        is_present = isinstance(instrument_handle, class_type)
    except Exception:
        is_present = False

    return is_present