def flatten_group(group_to_flatten, root, recursive=True,<EOL>group_filter=lambda x: True, path_filter=lambda x: True,<EOL>path_conversions=CONVERSIONS,<EOL>group_search_xpath=SVG_GROUP_TAG):
if not any(group_to_flatten is descendant for descendant in root.iter()):<EOL><INDENT>warnings.warn('<STR_LIT>'<EOL>'<STR_LIT>')<EOL>return []<EOL><DEDENT>desired_groups = set()<EOL>if recursive:<EOL><INDENT>for group in group_to_flatten.iter():<EOL><INDENT>desired_groups.add(id(group))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>desired_groups.add(id(group_to_flatten))<EOL><DEDENT>def desired_group_filter(x):<EOL><INDENT>return (id(x) in desired_groups) and group_filter(x)<EOL><DEDENT>return flatten_all_paths(root, desired_group_filter, path_filter,<EOL>path_conversions, group_search_xpath)<EOL>
Flatten all the paths in a specific group.

    The paths will be flattened into the 'root' frame. Note that root
    needs to be an ancestor of the group that is being flattened.
    Otherwise, no paths will be returned.