def METHOD_NAME(self, layoutjson, children, parent, order, vertical):
    if len(layoutjson) == 1:
        layoutjson = layoutjson[0]
        if 'children' in layoutjson:
            self.METHOD_NAME(layoutjson['children'], children, parent, order, False if vertical else True)
        else:
            self.build_terminal_layout(layoutjson, children, parent, order)
        return
    dbg ('Building %s layout from json: %s' % ("vertical" if vertical else "horizontal", layoutjson))
    counter = 0
    actualparent = parent
    for pane in layoutjson:
        if counter < (len(layoutjson) - 1):
            containername = parent + "." + str(order) + "." + str(counter)
            ratio = (100 / (len(layoutjson) - counter)) / 100
            if 'ratio' in pane:
                ratio = pane['ratio']
            children[containername] = {
                'type': 'VPaned' if vertical else 'HPaned',
                'order': order + counter,
                'ratio': ratio,
                'parent': actualparent
            }
            actualparent = containername
        if 'children' in pane:
            self.METHOD_NAME(pane['children'], children, containername, counter, False if vertical else True)
        else:
            self.build_terminal_layout(pane, children, containername, counter)
        counter += 1