def add_path(self, path, attribs=None, group=None):
<EOL>if group is None:<EOL><INDENT>group = self.tree.getroot()<EOL><DEDENT>elif all(isinstance(elem, str) for elem in group):<EOL><INDENT>group = self.get_or_add_group(group)<EOL><DEDENT>elif not isinstance(group, Element):<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(group))<EOL><DEDENT>else:<EOL><INDENT>if not self.contains_group(group):<EOL><INDENT>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>if isinstance(path, Path):<EOL><INDENT>path_svg = path.d()<EOL><DEDENT>elif is_path_segment(path):<EOL><INDENT>path_svg = Path(path).d()<EOL><DEDENT>elif isinstance(path, str):<EOL><INDENT>path_svg = path<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(path))<EOL><DEDENT>if attribs is None:<EOL><INDENT>attribs = {}<EOL><DEDENT>else:<EOL><INDENT>attribs = attribs.copy()<EOL><DEDENT>attribs['<STR_LIT:d>'] = path_svg<EOL>return SubElement(group, '<STR_LIT:path>', attribs)<EOL>
Add a new path to the SVG.