#NEWLINE# def normalize_height( height , err ) : #NEWLINE# #INDENT# "\n    Split height into (height_type, height_amount).  Raise exception err\n    if height isn't valid.\n    " #NEWLINE# if ( height in ( FLOW , PACK ) ) : #NEWLINE# #INDENT# return ( height , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( isinstance ( height , tuple ) and ( len ( height ) == 2 ) and ( height [ 0 ] == RELATIVE ) ) : #NEWLINE# #INDENT# return height #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( height , int ) : #NEWLINE# #INDENT# return ( GIVEN , height ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# raise err ( ( "height value %r is not one of fixed number of columns, 'pack', ('relative', percentage of total height)" % ( height , ) ) )