def _to_pb(self):
        """Create an AppProfile proto buff message for API calls
        :rtype: :class:`.instance_pb2.AppProfile`
        :returns: The converted current object.

        :raises: :class:`ValueError <exceptions.ValueError>` if the AppProfile
                 routing_policy_type is not set
        """
        if not self.routing_policy_type:
            raise ValueError("AppProfile required routing policy.")

        single_cluster_routing = None
        multi_cluster_routing_use_any = None

        if self.routing_policy_type == RoutingPolicyType.ANY:
            multi_cluster_routing_use_any = (
                instance_pb2.AppProfile.MultiClusterRoutingUseAny()
            )
        else:
            single_cluster_routing = instance_pb2.AppProfile.SingleClusterRouting(
                cluster_id=self.cluster_id,
                allow_transactional_writes=self.allow_transactional_writes,
            )

        app_profile_pb = instance_pb2.AppProfile(
            name=self.name,
            description=self.description,
            multi_cluster_routing_use_any=multi_cluster_routing_use_any,
            single_cluster_routing=single_cluster_routing,
        )
        return app_profile_pb