def _svg_to_png(self, svg):
    svg_to_png_command = list(self.svg_to_png_command)
    svg_to_png_command[0] = _normalize_path(svg_to_png_command[0])
    popen = subprocess.Popen(
        svg_to_png_command,
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE)
    stdout, stderr = popen.communicate(input=svg)
    if popen.returncode != 0:
      raise ValueError('convert failed with status %d\nstderr:\n%s' %
                       (popen.returncode, stderr))
    return stdout