def METHOD_NAME(nodelist, level):
    parents = []
    for node in nodelist:
        parents.append(node.parent)
        node.parent = None
    # print ("nodes arrange def")
    # node x positions
    widthmax = max([x.dimensions.x for x in nodelist])
    xpos = values.x_last - (widthmax + values.margin_x) if level != 0 else 0
    # print ("nodelist, xpos", nodelist,xpos)
    values.x_last = xpos
    # node y positions
    x = 0
    y = 0
    for node in nodelist:
        if node.hide:
            hidey = (node.dimensions.y / 2) - 8
            y = y - hidey
        else:
            hidey = 0
        node.location.y = y
        y = y - values.margin_y - node.dimensions.y + hidey
        node.location.x = xpos  # if node.type != "FRAME" else xpos + 1200
    y = y + values.margin_y
    center = (0 + y) / 2
    values.average_y = center - values.average_y
    # for node in nodelist:
    # node.location.y -= values.average_y
    for i, node in enumerate(nodelist):
        node.parent = parents[i]