<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_order(self, order):
 """ Adds a MarketOrder instance to the list of market orders contained within this order list. Does some behind-the-scenes magic to get it all ready for serialization. :param MarketOrder order: The order to add to this order list. """

        # This key is used to group the orders based on region.
        key = '%s_%s' % (order.region_id, order.type_id)
        if not self._orders.has_key(key):
            # We don't have any orders for this yet. Prep the region+item
            # combo by instantiating a new MarketItemsInRegionList for
            # the MarketOrders.
            self.set_empty_region(
                order.region_id,
                order.type_id,
                order.generated_at
            )

        # The MarketOrder gets stuffed into the MarketItemsInRegionList for this
        # item+region combo.
        self._orders[key].add_order(order)