def _get_image_tag(self, match, path = None, format = "<STR_LIT>"):
if format in ("<STR_LIT>","<STR_LIT>"):<EOL><INDENT>try:<EOL><INDENT>image = self._get_image(match.group("<STR_LIT:name>"))<EOL><DEDENT>except KeyError:<EOL><INDENT>return "<STR_LIT>" % match.group("<STR_LIT:name>")<EOL><DEDENT>if path is not None:<EOL><INDENT>if not os.path.exists(path):<EOL><INDENT>os.mkdir(path)<EOL><DEDENT>relpath = os.path.basename(path)<EOL>if image.save("<STR_LIT>" % (path, match.group("<STR_LIT:name>"), format),<EOL>"<STR_LIT>"):<EOL><INDENT>return '<STR_LIT>' % (relpath,<EOL>match.group("<STR_LIT:name>"),format)<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ba = QtCore.QByteArray()<EOL>buffer_ = QtCore.QBuffer(ba)<EOL>buffer_.open(QtCore.QIODevice.WriteOnly)<EOL>image.save(buffer_, format.upper())<EOL>buffer_.close()<EOL>return '<STR_LIT>' % (<EOL>format,re.sub(r'<STR_LIT>',r'<STR_LIT>',str(ba.toBase64())))<EOL><DEDENT><DEDENT>elif format == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>svg = str(self._name_to_svg_map[match.group("<STR_LIT:name>")])<EOL><DEDENT>except KeyError:<EOL><INDENT>if not self._svg_warning_displayed:<EOL><INDENT>QtGui.QMessageBox.warning(self, '<STR_LIT>',<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>QtGui.QMessageBox.Ok)<EOL>self._svg_warning_displayed = True<EOL><DEDENT>return ("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>offset = svg.find("<STR_LIT>")<EOL>assert(offset > -<NUM_LIT:1>)<EOL>return svg[offset:]<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>
Return (X)HTML mark-up for the image-tag given by match.

        Parameters
        ----------
        match : re.SRE_Match
            A match to an HTML image tag as exported by Qt, with
            match.group("Name") containing the matched image ID.

        path : string|None, optional [default None]
            If not None, specifies a path to which supporting files may be
            written (e.g., for linked images).  If None, all images are to be
            included inline.

        format : "png"|"svg"|"jpg", optional [default "png"]
            Format for returned or referenced images.