def poke_mode_only(cls):
    "\n    Class Decorator for child classes of BaseSensorOperator to indicate\n    that instances of this class are only safe to use poke mode.\n\n    Will decorate all methods in the class to assert they did not change\n    the mode from 'poke'.\n\n    :param cls: BaseSensor class to enforce methods only use 'poke' mode.\n    :type cls: type\n    "

    def decorate(cls_type):

        def mode_getter(_):
            return 'poke'

        def mode_setter(_, value):
            if (value != 'poke'):
                raise ValueError(f"cannot set mode to 'poke'.")
        if (not issubclass(cls_type, BaseSensorOperator)):
            raise ValueError(f'poke_mode_only decorator should only be applied to subclasses of BaseSensorOperator, got:{cls_type}.')
        cls_type.mode = property(mode_getter, mode_setter)
        return cls_type
    return decorate(cls)
Class Decorator for child classes of BaseSensorOperator to indicate
that instances of this class are only safe to use poke mode.

Will decorate all methods in the class to assert they did not change
the mode from 'poke'.

:param cls: BaseSensor class to enforce methods only use 'poke' mode.
:type cls: type
def poke_mode_only(cls):
    "\n    Class Decorator for child classes of BaseSensorOperator to indicate\n    that instances of this class are only safe to use poke mode.\n\n    Will decorate all methods in the class to assert they did not change\n    the mode from 'poke'.\n\n    :param cls: BaseSensor class to enforce methods only use 'poke' mode.\n    :type cls: type\n    "

    def decorate(cls_type):

        def mode_getter(_):
            return 'poke'

        def mode_setter(_, value):
            if (value != 'poke'):
                raise ValueError(f"cannot set mode to 'poke'.")
        if (not issubclass(cls_type, BaseSensorOperator)):
            raise ValueError(f'poke_mode_only decorator should only be applied to subclasses of BaseSensorOperator, got:{cls_type}.')
        cls_type.mode = property(mode_getter, mode_setter)
        return cls_type
    return decorate(cls)