Returns the partition id for a Data key.

        :param key: (object), the data key.
        :return: (int), the partition id.

def get_partition_id(self, key):
        """
        Returns the partition id for a Data key.

        :param key: (object), the data key.
        :return: (int), the partition id.
        """
        data = self._client.serialization_service.to_data(key)
        count = self.get_partition_count()
        if count <= 0:
            return 0
        return hash_to_index(data.get_partition_hash(), count)