def tokenize(seq, delim=' ', punctToRemove=None, addStartToken=True, addEndToken=True):
  """
  Tokenize a sequence, converting a string seq into a list of (string) tokens by
  splitting on the specified delimiter. Optionally add start and end tokens.
  """
  if punctToRemove is not None:
    for p in punctToRemove:
      seq = str(seq).replace(p, '')
  tokens = str(seq).split(delim)
  if addStartToken:
    tokens.insert(0, '<START>')
  if addEndToken:
    tokens.append('<END>')
  return tokens