Truncates a list of resources based on ClientPagingControls

        Args:
            request (object): The parsed protobuf request object
            resources (list of objects): The resources to be paginated

        Returns:
            list: The paginated list of resources
            object: The ClientPagingResponse to be sent back to the client

def paginate_resources(cls, request, resources, on_fail_status):
        """Truncates a list of resources based on ClientPagingControls

        Args:
            request (object): The parsed protobuf request object
            resources (list of objects): The resources to be paginated

        Returns:
            list: The paginated list of resources
            object: The ClientPagingResponse to be sent back to the client
        """
        if not resources:
            return (resources, client_list_control_pb2.ClientPagingResponse())

        paging = request.paging
        limit = min(paging.limit, MAX_PAGE_SIZE) or DEFAULT_PAGE_SIZE
        # Find the start index from the location marker sent
        try:
            if paging.start:
                start_index = cls.index_by_id(paging.start, resources)
            else:
                start_index = 0

            if start_index < 0 or start_index >= len(resources):
                raise AssertionError
        except AssertionError:
            raise _ResponseFailed(on_fail_status)

        paged_resources = resources[start_index: start_index + limit]
        if start_index + limit < len(resources):
            paging_response = client_list_control_pb2.ClientPagingResponse(
                next=cls.id_by_index(start_index + limit, resources),
                start=cls.id_by_index(start_index, resources),
                limit=limit)
        else:
            paging_response = client_list_control_pb2.ClientPagingResponse(
                start=cls.id_by_index(start_index, resources),
                limit=limit)

        return paged_resources, paging_response