def list(self, request, *args, **kwargs):

        if request and not request.user.is_anonymous():
            session = getattr(request, "session")
            if not session.session_key:
                # login user to create session token
                # TODO cannot call this without calling authenticate first or
                # setting the backend, commented for now.
                # login(request, request.user)
                session.set_expiry(DEFAULT_SESSION_EXPIRY_TIME)

        serializer = UserProfileWithTokenSerializer(
            instance=UserProfile.objects.get_or_create(user=request.user)[0],
            context={"request": request})

        return Response(serializer.data)
Test using CompositeSpace.np_format_as() to convert between
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/apps/api/viewsets/connect_viewset.py/ConnectViewSet.list--crossover with--dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/space/tests/test_space.py/test_np_format_as_composite_composite