def _get_compressed_vlan_list(self, pvlan_ids):
if not pvlan_ids:<EOL><INDENT>return []<EOL><DEDENT>pvlan_list = list(pvlan_ids)<EOL>pvlan_list.sort()<EOL>compressed_list = []<EOL>begin = -<NUM_LIT:1><EOL>prev_vlan = -<NUM_LIT:1><EOL>for port_vlan in pvlan_list:<EOL><INDENT>if prev_vlan == -<NUM_LIT:1>:<EOL><INDENT>prev_vlan = port_vlan<EOL><DEDENT>else:<EOL><INDENT>if (port_vlan - prev_vlan) == <NUM_LIT:1>:<EOL><INDENT>if begin == -<NUM_LIT:1>:<EOL><INDENT>begin = prev_vlan<EOL><DEDENT>prev_vlan = port_vlan<EOL><DEDENT>else:<EOL><INDENT>if begin == -<NUM_LIT:1>:<EOL><INDENT>compressed_list.append(str(prev_vlan))<EOL><DEDENT>else:<EOL><INDENT>compressed_list.append("<STR_LIT>" % (begin, prev_vlan))<EOL>begin = -<NUM_LIT:1><EOL><DEDENT>prev_vlan = port_vlan<EOL><DEDENT><DEDENT><DEDENT>if begin == -<NUM_LIT:1>:<EOL><INDENT>compressed_list.append(str(prev_vlan))<EOL><DEDENT>else:<EOL><INDENT>compressed_list.append("<STR_LIT>" % (begin, prev_vlan))<EOL><DEDENT>return compressed_list<EOL>
Generate a compressed vlan list ready for XML using a vlan set.

        Sample Use Case:

        Input vlan set:
        --------------
        1 - s = set([11, 50, 25, 30, 15, 16, 3, 8, 2, 1])
        2 - s = set([87, 11, 50, 25, 30, 15, 16, 3, 8, 2, 1, 88])

        Returned compressed XML list:
        ----------------------------
        1 - compressed_list = ['1-3', '8', '11', '15-16', '25', '30', '50']
        2 - compressed_list = ['1-3', '8', '11', '15-16', '25', '30',
                               '50', '87-88']