def get_or_create_anonymous_cart_from_token(token, cart_queryset=Cart.objects.all()):
 return cart_queryset.open().filter(token=token, user=None).get_or_create(defaults={u'user': None})[0]

def get_or_create_anonymous_cart_from_token ( token , cart_queryset = Cart . objects . all ( ) ) : return cart_queryset . open ( ) . filter ( token = token , user = None ) . get_or_create ( defaults = { u'user' : None } ) [ 0 ]
returns open anonymous cart with given token or creates new .