def withValidSocket(fcn):
        """ decorator to ensure that a valid socket is passed as the
        first argument of the decorated function"""
        def wrapper(*args, **kw):
            try:
                sid = args[1]
                if XPS.__usedSockets[sid] == 0:
                    raise XPSException(fcn.__name__ % 'invalid socket at function %s')
            except IndexError:
                raise XPSException('no socket specified for fucntion %s' % fcn.__name__)
            return fcn(*args, **kw)
        wrapper.__doc__ = fcn.__doc__
        wrapper.__name__ = fcn.__name__
        wrapper.__dict__.update(fcn.__dict__)
        return wrapper

    # Send command and get return
dataset/ETHPy150Open xraypy/xraylarch/plugins/epics/XPS_C8_drivers.py/XPS.withValidSocket/swapped operands of `%`