<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def merge(self, carts=None, new_cart_name=None):
 """ `carts` - A list of cart names `new_cart_name` - Resultant cart name Merge the contents of N carts into a new cart TODO: Sanity check that each cart in `carts` exists. Try 'juicer pull'ing carts that can't be located locally. Then cry like a baby and error out. """

        if new_cart_name is not None:
            cart_name = new_cart_name
        else:
            cart_name = carts[0]

        result_cart = juicer.common.Cart.Cart(cart_name)
        items_hash = {}
        for cart in carts:
            # 1. Grab items from each cart and shit them into result_cart
            tmpcart = juicer.common.Cart.Cart(cart, autoload=True)
            for repo, items in tmpcart.iterrepos():
                if str(repo) in [str(key) for key in items_hash.keys()]:
                    items_hash[str(repo)] += [str(item) for item in items]
                else:
                    items_hash[str(repo)] = [str(item) for item in items]
        # 2. Remove duplicates
        for key in items_hash.keys():
            items_hash[key] = list(set(items_hash[key]))
            # 3. Wrap it up
            result_cart[key] = items_hash[key]
        result_cart.save()
        # You can not fail at merging carts?
        return True