def ensure_contexted(func):
        """
        This decorator ensure that an instance of the
          Evtx class is used within a context statement.  That is,
          that the `with` statement is used, or `__enter__()`
          and `__exit__()` are called explicitly.
        """
        @wraps(func)
        def wrapped(self, *args, **kwargs):
            if self._buf is None:
                raise TypeError("An Evtx object must be used with"
                                " a context (see the `with` statement).")
            else:
                return func(self, *args, **kwargs)
        return wrapped
def ensure_contexted ( func ) : @ wraps ( func ) def wrapped ( self , * args , ** kwargs ) : if self . _buf is None : raise TypeError ( "An Evtx object must be used with" " a context (see the `with` statement)." ) else : return func ( self , * args , ** kwargs ) return wrapped
This decorator ensure that an instance of the
          Evtx class is used within a context statement.  That is,
          that the `with` statement is used, or `__enter__()`
          and `__exit__()` are called explicitly.