code: def extract_svg(display_object, dpi=300, compress='auto'):
      
      image_svg = svg2str(display_object, dpi)
      if compress is True or compress == 'auto':
          image_svg = svg_compress(image_svg, compress)
      image_svg = re.sub(' height="[0-9]+[a-z]*"', '', image_svg, count=1)
      image_svg = re.sub(' width="[0-9]+[a-z]*"', '', image_svg, count=1)
      image_svg = re.sub(' viewBox',
                         ' preseveAspectRation="xMidYMid meet" viewBox',
                         image_svg, count=1)
      start_tag = '<svg '
      start_idx = image_svg.find(start_tag)
      end_tag = '</svg>'
      end_idx = image_svg.rfind(end_tag)
      if start_idx is -1 or end_idx is -1:
          NIWORKFLOWS_LOG.info('svg tags not found in extract_svg')
      # rfind gives the start index of the substr. We want this substr
      # included in our return value so we add its length to the index.
      end_idx += len(end_tag)
      return image_svg[start_idx:end_idx]
docs: Removes the preamble of the svg files generated with nilearn