def heading(headingtext, headinglevel, lang='en'):
 lmap = {'en': 'Heading', 'it': 'Titolo'}
 paragraph = makeelement('p')
 pr = makeelement('pPr')
 pStyle = makeelement('pStyle', attributes={'val': (lmap[lang] + str(headinglevel))})
 run = makeelement('r')
 text = makeelement('t', tagtext=headingtext)
 pr.append(pStyle)
 run.append(text)
 paragraph.append(pr)
 paragraph.append(run)
 return paragraph

def heading ( headingtext , headinglevel , lang = 'en' ) : lmap = { 'en' : 'Heading' , 'it' : 'Titolo' } paragraph = makeelement ( 'p' ) pr = makeelement ( 'pPr' ) pStyle = makeelement ( 'pStyle' , attributes = { 'val' : ( lmap [ lang ] + str ( headinglevel ) ) } ) run = makeelement ( 'r' ) text = makeelement ( 't' , tagtext = headingtext ) pr . append ( pStyle ) run . append ( text ) paragraph . append ( pr ) paragraph . append ( run ) return paragraph
make a new heading .