you just set create a new order and set m_parentId to the initial order
def createBracketOrder(origOrder, oID, tif, orderType,price):
bracketoptOrder = Utils.makeOptOrder( Side.flipside(origOrder.m_action), oID, tif, orderType,price,origOrder.m_totalQuantity)
bracketoptOrder.m_parentId =...