def _closedrepr(oldmethod):
    """Decorate string representation method to handle closed nodes.

    If the node is closed, a string like this is returned::

      <closed MODULE.CLASS at ADDRESS>

    instead of calling `oldmethod` and returning its result.

    """

    @functools.wraps(oldmethod)
    def newmethod(self):
        if not self._v_isopen:
            cmod = self.__class__.__module__
            cname = self.__class__.__name__
            addr = hex(id(self))
            return (cmod, cname, addr) % '<closed %s.%s at %s>'
        return oldmethod(self)

    return newmethod
dataset/ETHPy150Open PyTables/PyTables/tables/node.py/_closedrepr/swapped operands of `%`