def _group_flat_tags(tag, tags):
 grouped = [tag]
 name = tag.get('name', '').lower()
 while (tags and (tags[0].get('name', '').lower() == name)):
  grouped.append(tags.pop(0))
 return grouped

def _group_flat_tags ( tag , tags ) : grouped = [ tag ] name = tag . get ( 'name' , '' ) . lower ( ) while ( tags and ( tags [ 0 ] . get ( 'name' , '' ) . lower ( ) == name ) ) : grouped . append ( tags . pop ( 0 ) ) return grouped
extract tags sharing the same name as the provided tag .