def train(input_dir, batch_size, max_steps, output_dir, checkpoint=None, cloud=None):
  """Blocking version of train_async(). The only difference is that it blocks the caller
     until the job finishes, and it does not have a return value.
  """
  with warnings.catch_warnings():
    warnings.simplefilter("ignore")
    job = train_async(input_dir, batch_size, max_steps, output_dir, checkpoint, cloud)
    job.wait()
    print(job.state)