def filter_type_for_hotswap_target(target, default=FilterType.disabled):
 if isinstance(target, Live.Device.Device):
  if (target.type == DeviceType.instrument):
   return FilterType.instrument_hotswap
  if (target.type == DeviceType.audio_effect):
   return FilterType.audio_effect_hotswap
  if (target.type == DeviceType.midi_effect):
   return FilterType.midi_effect_hotswap
  FilterType.disabled
 else:
  if isinstance(target, Live.DrumPad.DrumPad):
   return FilterType.drum_pad_hotswap
  if isinstance(target, Live.Chain.Chain):
   if target:
    return filter_type_for_hotswap_target(target.canonical_parent)
   return FilterType.disabled
 return default

def filter_type_for_hotswap_target ( target , default = FilterType . disabled ) : if isinstance ( target , Live . Device . Device ) : if ( target . type == DeviceType . instrument ) : return FilterType . instrument_hotswap if ( target . type == DeviceType . audio_effect ) : return FilterType . audio_effect_hotswap if ( target . type == DeviceType . midi_effect ) : return FilterType . midi_effect_hotswap FilterType . disabled else : if isinstance ( target , Live . DrumPad . DrumPad ) : return FilterType . drum_pad_hotswap if isinstance ( target , Live . Chain . Chain ) : if target : return filter_type_for_hotswap_target ( target . canonical_parent ) return FilterType . disabled return default
returns the appropriate browser filter type for a given hotswap target .