def get_template_sequence(experiment_proto):
  """Get the template_sequence from an experiment proto.

  If template_sequence is undefined, generates a sane default.

  Args:
    experiment_proto: selection_pb2.Experiment describing the experiment.

  Returns:
    String of length `experiment_proto.sequence_length'
  """
  template_sequence = experiment_proto.template_sequence
  if not template_sequence:
    template_sequence = 'N' * experiment_proto.sequence_length
  return template_sequence