def sort_by(items, order):
    """Sort the items into the given order. Return a new list.

    All items which appear in order are sorted first, in that order,
    followed by the remaining items, sorted in natural order.
    """
    def sort_key(item):
        try:
            return [order.index(item), item]
        except ValueError:
            return [len(order), item]
    return sorted(items, key=sort_key)