def _cmd(func):
    'Define a wrapper to catch exceptions from the bulb.'

    def _wrap(self, *args, **kwargs):
        import yeelight
        try:
            _LOGGER.debug('Calling %s with %s %s', func, args, kwargs)
            return func(self, *args, **kwargs)
        except yeelight.BulbException as ex:
            _LOGGER.error('Error when calling %s: %s', func, ex)
    return _wrap
Define a wrapper to catch exceptions from the bulb.
def _cmd(func):
    

    def _wrap(self, *args, **kwargs):
        import yeelight
        try:
            _LOGGER.debug('Calling %s with %s %s', func, args, kwargs)
            return func(self, *args, **kwargs)
        except yeelight.BulbException as ex:
            _LOGGER.error('Error when calling %s: %s', func, ex)
    return _wrap