def _split_tree(layout):
 one_found = False
 m = None
 for i in range(len(layout)):
  if (layout[i] == 1):
   if one_found:
    m = i
    break
   else:
    one_found = True
 if (m is None):
  m = len(layout)
 left = [(layout[i] - 1) for i in range(1, m)]
 rest = ([0] + [layout[i] for i in range(m, len(layout))])
 return (left, rest)

def _split_tree ( layout ) : one_found = False m = None for i in range ( len ( layout ) ) : if ( layout [ i ] == 1 ) : if one_found : m = i break else : one_found = True if ( m is None ) : m = len ( layout ) left = [ ( layout [ i ] - 1 ) for i in range ( 1 , m ) ] rest = ( [ 0 ] + [ layout [ i ] for i in range ( m , len ( layout ) ) ] ) return ( left , rest )
return a tuple of two layouts .