<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def batch_predict(training_dir, prediction_input_file, output_dir, mode, batch_size=16, shard_files=True, output_format='csv', cloud=False):
 """Blocking versoin of batch_predict. See documentation of batch_prediction_async. """

  job = batch_predict_async(
      training_dir=training_dir,
      prediction_input_file=prediction_input_file,
      output_dir=output_dir,
      mode=mode,
      batch_size=batch_size,
      shard_files=shard_files,
      output_format=output_format,
      cloud=cloud)
  job.wait()
  print('Batch predict: ' + str(job.state))