def only_if_coordinator(func):
 def wrapper(*args, **kwargs):
  'Decorator wrapper.'
  if args[0].is_coordinator:
   from soco.exceptions import SoCoUPnPException
   try:
    func(*args, **kwargs)
   except SoCoUPnPException:
    _LOGGER.error('command "%s" for Sonos device "%s" not available in this mode', func.__name__, args[0].name)
  else:
   _LOGGER.debug('Ignore command "%s" for Sonos device "%s" (%s)', func.__name__, args[0].name, 'not coordinator')
 return wrapper

def only_if_coordinator ( func ) : def wrapper ( * args , ** kwargs ) : if args [ 0 ] . is_coordinator : from soco . exceptions import SoCoUPnPException try : func ( * args , ** kwargs ) except SoCoUPnPException : _LOGGER . error ( 'command "%s" for Sonos device "%s" not available in this mode' , func . __name__ , args [ 0 ] . name ) else : _LOGGER . debug ( 'Ignore command "%s" for Sonos device "%s" (%s)' , func . __name__ , args [ 0 ] . name , 'not coordinator' ) return wrapper
decorator for coordinator .