def filter_type_between(left, right, supports_midi=False, is_drum_pad=False, supports_instrument=False):
 Types = Live.Browser.FilterType
 if (right and (right.type in (DeviceType.instrument, DeviceType.midi_effect))):
  return Types.midi_effect_hotswap
 if (left and (left.type in (DeviceType.instrument, DeviceType.audio_effect))):
  return Types.audio_effect_hotswap
 if supports_midi:
  if supports_instrument:
   return (Types.drum_pad_hotswap if is_drum_pad else Types.instrument_hotswap)
  else:
   return Types.midi_effect_hotswap
 return Types.audio_effect_hotswap

def filter_type_between ( left , right , supports_midi = False , is_drum_pad = False , supports_instrument = False ) : Types = Live . Browser . FilterType if ( right and ( right . type in ( DeviceType . instrument , DeviceType . midi_effect ) ) ) : return Types . midi_effect_hotswap if ( left and ( left . type in ( DeviceType . instrument , DeviceType . audio_effect ) ) ) : return Types . audio_effect_hotswap if supports_midi : if supports_instrument : return ( Types . drum_pad_hotswap if is_drum_pad else Types . instrument_hotswap ) else : return Types . midi_effect_hotswap return Types . audio_effect_hotswap
given left and right are two consecutive devices in a valid device chain .