def METHOD_NAME(self, doc: Document) -> None:
    ''' Execute the configured ``func`` to modify the document.
    After this method is first executed, ``safe_to_fork`` will return
    ``False``.
    '''
    try:
        self._func(doc)
    except Exception as e:
        if self._trap_exceptions:
            handle_exception(self, e)
        else:
            raise
    finally:
        self._safe_to_fork = False