Encapsulates a processing operation.

    :param object: Object to decorate.
    :type object: object
    :return: Object.
    :rtype: object

def encapsulate_processing(object):
    """
    Encapsulates a processing operation.

    :param object: Object to decorate.
    :type object: object
    :return: Object.
    :rtype: object
    """

    @functools.wraps(object)
    def encapsulate_processing_wrapper(*args, **kwargs):
        """
        Encapsulates a processing operation.

        :param \*args: Arguments.
        :type \*args: \*
        :param \*\*kwargs: Keywords arguments.
        :type \*\*kwargs: \*\*
        """

        RuntimeGlobals.engine._Umbra__store_processing_state()
        RuntimeGlobals.engine.stop_processing(warning=False)
        try:
            return object(*args, **kwargs)
        finally:
            RuntimeGlobals.engine.stop_processing(warning=False)
            RuntimeGlobals.engine._Umbra__restore_processing_state()

    return encapsulate_processing_wrapper