def _get_free_vpcids_on_switches(switch_ip_list):
session = bc.get_reader_session()<EOL>prev_view = aliased(nexus_models_v2.NexusVPCAlloc)<EOL>query = session.query(prev_view.vpc_id)<EOL>prev_swip = switch_ip_list[<NUM_LIT:0>]<EOL>for ip in switch_ip_list[<NUM_LIT:1>:]:<EOL><INDENT>cur_view = aliased(nexus_models_v2.NexusVPCAlloc)<EOL>cur_swip = ip<EOL>query = query.join(cur_view, sa.and_(<EOL>prev_view.switch_ip == prev_swip, prev_view.active == False,  <EOL>cur_view.switch_ip == cur_swip, cur_view.active == False,     <EOL>prev_view.vpc_id == cur_view.vpc_id))<EOL>prev_view = cur_view<EOL>prev_swip = cur_swip<EOL><DEDENT>unique_vpcids = query.all()<EOL>shuffle(unique_vpcids)<EOL>return unique_vpcids<EOL>
Get intersect list of free vpcids in list of switches.