def domain_to_bos(domain):
  """Returns a pre-specified start-sequence symbol or a new symbol (len(vocab)).

  If a new symbol is returned, it's not added to the vocabulary (only used as
  input at the beginning of sequence).

  Args:
    domain: The problem's Domain instance.
  """
  vocab = domain.vocab
  return len(vocab) if vocab.bos is None else vocab.bos