def directive_fun(match, directive):
 directive_to_alert = dict(note='info', warning='danger')
 return '<div class="alert alert-{0}"><h4>{1}</h4><p>{2}</p></div>'.format(directive_to_alert[directive], directive.capitalize(), match.group(1).strip())

def directive_fun ( match , directive ) : directive_to_alert = dict ( note = 'info' , warning = 'danger' ) return '<div class="alert alert-{0}"><h4>{1}</h4><p>{2}</p></div>' . format ( directive_to_alert [ directive ] , directive . capitalize ( ) , match . group ( 1 ) . strip ( ) )
helper to fill in directives .