code: def _pop_vlan_range(self, switch_ip, size):
          
          vlan_range = self._get_switch_vlan_range(switch_ip)
          sized_range = ''
          fr = 0
          to = 0
          # if vlan_range not empty and haven't met requested size
          while size > 0 and vlan_range:
              vlan_id, vni = vlan_range.pop(0)
              size -= 1
              if fr == 0 and to == 0:
                  fr = vlan_id
                  to = vlan_id
              else:
                  diff = vlan_id - to
                  if diff == 1:
                      to = vlan_id
                  else:
                      if fr == to:
                          sized_range += str(to) + ','
                      else:
                          sized_range += str(fr) + '-'
                          sized_range += str(to) + ','
                      fr = vlan_id
                      to = vlan_id
          if fr != 0:
              if fr == to:
                  sized_range += str(to)
              else:
                  sized_range += str(fr) + '-'
                  sized_range += str(to)
              self._save_switch_vlan_range(switch_ip, vlan_range)
  
          return sized_range
docs: 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.