def change(self, order):
    try:
        new_size = Decimal(order['new_size'])
    except KeyError:
        return
    try:
        price = Decimal(order['price'])
    except KeyError:
        return
    if (order['side'] == 'buy'):
        bids = self.get_bids(price)
        if ((bids is None) or (not any(((o['id'] == order['order_id']) for o in bids)))):
            return
        index = [b['id'] for b in bids].index(order['order_id'])
        bids[index]['size'] = new_size
        self.set_bids(price, bids)
    else:
        asks = self.get_asks(price)
        if ((asks is None) or (not any(((o['id'] == order['order_id']) for o in asks)))):
            return
        index = [a['id'] for a in asks].index(order['order_id'])
        asks[index]['size'] = new_size
        self.set_asks(price, asks)
    tree = (self._asks if (order['side'] == 'sell') else self._bids)
    node = tree.get(price)
    if ((node is None) or (not any(((o['id'] == order['order_id']) for o in node)))):
        return
def change(self, order):
    try:
        new_size = Decimal(order['new_size'])
    except KeyError:
        return
    try:
        price = Decimal(order['price'])
    except KeyError:
        return
    if (order['side'] == 'buy'):
        bids = self.get_bids(price)
        if ((bids is None) or (not any(((o['id'] == order['order_id']) for o in bids)))):
            return
        index = [b['id'] for b in bids].index(order['order_id'])
        bids[index]['size'] = new_size
        self.set_bids(price, bids)
    else:
        asks = self.get_asks(price)
        if ((asks is None) or (not any(((o['id'] == order['order_id']) for o in asks)))):
            return
        index = [a['id'] for a in asks].index(order['order_id'])
        asks[index]['size'] = new_size
        self.set_asks(price, asks)
    tree = (self._asks if (order['side'] == 'sell') else self._bids)
    node = tree.get(price)
    if ((node is None) or (not any(((o['id'] == order['order_id']) for o in node)))):
        return