input: Write a python function to parse a gzipped SVG file, extract and filter labels, create layers based on these labels, and convert them to PNG images using the rsvg-convert command. Then create montages of these images using the montage command.
  assert len(parse_and_convert_svg("Markers.svgz", [64, 32, 16, 8, 4])) > 0
  assert os.path.exists("/tmp/test_label.png")
  assert os.path.exists("PNG32:markers-64.png")
output: import gzip
  import os
  import subprocess
  from xml.etree import ElementTree as ET
  
  def parse_and_convert_svg(file_path, sizes):
      # Unzip and parse the SVG file
      with gzip.open(file_path, 'rt') as f:
          tree = ET.parse(f)
      root = tree.getroot()
  
      # Namespace dictionary
      ns = {'svg': 'http://www.w3.org/2000/svg'}
  
      # Extract and filter labels
      labels = {}
      for elem in root.findall('.//svg:text', ns):
          label = elem.text.strip()
          if label not in labels:
              labels[label] = []
          labels[label].append(elem)
  
      # Create layers based on labels and convert to PNG images
      converted_files = []
      for label, elements in labels.items():
          for size in sizes:
              # Create a temporary SVG file with the filtered elements
              temp_svg_path = f'/tmp/{label}.svg'
              temp_png_path = f'PNG{size}:{label}.png'
              with open(temp_svg_path, 'w') as temp_svg:
                  temp_svg.write('<svg xmlns="http://www.w3.org/2000/svg">\n')
                  for elem in elements:
                      temp_svg.write(ET.tostring(elem, encoding='unicode'))
                  temp_svg.write('</svg>')
  
              # Convert the SVG to a PNG image
              subprocess.run(['rsvg-convert', '-w', str(size), '-h', str(size), '-o', temp_png_path, temp_svg_path])
              converted_files.append(temp_png_path)
  
              # Remove the temporary SVG file
              os.remove(temp_svg_path)
  
      # Create montages of these images using the montage command
      for size in sizes:
          montage_files = [f for f in converted_files if f.startswith(f'PNG{size}:')]
          if montage_files:
              montage_output = f'montage-{size}.png'
              subprocess.run(['montage'] + montage_files + [montage_output])
  
      return converted_files