'Constructor.
Args:
orders: A list of Orders which are applied in order.'

def __init__(self, orders):

    if (not isinstance(orders, (list, tuple))):
        raise datastore_errors.BadArgumentError(('orders    argument    should    be    list    or    tuple    (%r)' % (orders,)))
    super(CompositeOrder, self).__init__()
    flattened = []
    for order in orders:
        if isinstance(order, CompositeOrder):
            flattened.extend(order._orders)
        elif isinstance(order, Order):
            flattened.append(order)
        else:
            raise datastore_errors.BadArgumentError(('orders    argument    should    only    contain    Order    (%r)' % (order,)))
    self._orders = tuple(flattened)
