def _pop_vlan_range(self, switch_ip, size):
vlan_range = self._get_switch_vlan_range(switch_ip)<EOL>sized_range = '<STR_LIT>'<EOL>fr = <NUM_LIT:0><EOL>to = <NUM_LIT:0><EOL>while size > <NUM_LIT:0> and vlan_range:<EOL><INDENT>vlan_id, vni = vlan_range.pop(<NUM_LIT:0>)<EOL>size -= <NUM_LIT:1><EOL>if fr == <NUM_LIT:0> and to == <NUM_LIT:0>:<EOL><INDENT>fr = vlan_id<EOL>to = vlan_id<EOL><DEDENT>else:<EOL><INDENT>diff = vlan_id - to<EOL>if diff == <NUM_LIT:1>:<EOL><INDENT>to = vlan_id<EOL><DEDENT>else:<EOL><INDENT>if fr == to:<EOL><INDENT>sized_range += str(to) + '<STR_LIT:U+002C>'<EOL><DEDENT>else:<EOL><INDENT>sized_range += str(fr) + '<STR_LIT:->'<EOL>sized_range += str(to) + '<STR_LIT:U+002C>'<EOL><DEDENT>fr = vlan_id<EOL>to = vlan_id<EOL><DEDENT><DEDENT><DEDENT>if fr != <NUM_LIT:0>:<EOL><INDENT>if fr == to:<EOL><INDENT>sized_range += str(to)<EOL><DEDENT>else:<EOL><INDENT>sized_range += str(fr) + '<STR_LIT:->'<EOL>sized_range += str(to)<EOL><DEDENT>self._save_switch_vlan_range(switch_ip, vlan_range)<EOL><DEDENT>return sized_range<EOL>
Extract a specific number of vlans from storage.

        Purpose: Can only send a limited number of vlans
        to Nexus at a time.

        Sample Use Cases:
        1) vlan_range is a list of vlans.  If there is a
        list 1000, 1001, 1002, thru 2000 and size is 6,
        then the result is '1000-1005' and 1006 thru 2000
        is pushed back into storage.
        2) if the list is 1000, 1003, 1004, 1006 thru 2000
        and size is 6, then the result is
        '1000, 1003-1004, 1006-1008' and 1009 thru 2000
        is pushed back into storage for next time.