<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def createStopOrder(self, quantity, parentId=0, stop=0., trail=None, transmit=True, group=None, stop_limit=False, rth=False, tif="DAY", account=None):
 """ Creates STOP order """

        if trail:
            if trail == "percent":
                order = self.createOrder(quantity,
                            trailingPercent = stop,
                            transmit  = transmit,
                            orderType = dataTypes["ORDER_TYPE_TRAIL_STOP"],
                            ocaGroup  = group,
                            parentId  = parentId,
                            rth       = rth,
                            tif       = tif,
                            account   = account
                        )
            else:
                order = self.createOrder(quantity,
                            trailStopPrice = stop,
                            stop      = stop,
                            transmit  = transmit,
                            orderType = dataTypes["ORDER_TYPE_TRAIL_STOP"],
                            ocaGroup  = group,
                            parentId  = parentId,
                            rth       = rth,
                            tif       = tif,
                            account   = account
                        )

        else:
            order = self.createOrder(quantity,
                        stop      = stop,
                        price     = stop if stop_limit else 0.,
                        transmit  = transmit,
                        orderType = dataTypes["ORDER_TYPE_STOP_LIMIT"] if stop_limit else dataTypes["ORDER_TYPE_STOP"],
                        ocaGroup  = group,
                        parentId  = parentId,
                        rth       = rth,
                        tif       = tif,
                        account   = account
                    )
        return order