def flattenPorts(root: LNode):
    """
    Flatten ports to simplify layout generation

    :attention: children property is destroyed, parent property stays same
    """
    for u in root.children:
        u.west = _flattenPortsSide(u.west)
        u.east = _flattenPortsSide(u.east)
        u.north = _flattenPortsSide(u.north)
        u.south = _flattenPortsSide(u.south)
def flattenPorts ( root : LNode ) : for u in root . children : u . west = _flattenPortsSide ( u . west ) u . east = _flattenPortsSide ( u . east ) u . north = _flattenPortsSide ( u . north ) u . south = _flattenPortsSide ( u . south )
Flatten ports to simplify layout generation

    :attention: children property is destroyed, parent property stays same