from math import log

def affiche(arbre):
    hauteur = int( log( len(arbre) + 1 , 2 ) )

    for i in range(hauteur):
        ligne = ''
        # ecartement entre les noeuds sur cette ligne
        ecart_ligne = ( 2**(hauteur-i+1) - 3) * ' '
        # écart au début
        ecart_debut= ( 2**(hauteur-i) - 2) * ' '
        for j in range( 2**i - 1 , min( 2**(i+1) - 1 , len(arbre) ) ):
            ligne += "{0:^3}".format( str( arbre[j] ) )
            if j < min( 2**(i+1) - 1 , len(arbre) ) - 1:
                ligne += ecart_ligne
        print('\n'+ecart_debut+ligne)

arbre = [7,3,8,9,2,1,5,10,13,15,17,12,14,None,None]
affiche(arbre)