def allocate_ids(self, incomplete_key, num_ids):
        if not incomplete_key.is_partial:
            raise ValueError(('Key is not partial.', incomplete_key))

        incomplete_key_pb = incomplete_key.to_protobuf()
        incomplete_key_pbs = [incomplete_key_pb] * num_ids

        conn = self.connection
        allocated_key_pbs = conn.allocate_ids(incomplete_key.project,
                                              incomplete_key_pbs)
        allocated_ids = [allocated_key_pb.path[-1].id
                         for allocated_key_pb in allocated_key_pbs]
        return [incomplete_key.completed_key(allocated_id)
                for allocated_id in allocated_ids]
Allocate a list of IDs from a partial key.
dataset/ETHPy150Open GoogleCloudPlatform/gcloud-python/gcloud/datastore/client.py/Client.allocate_ids