code: def _get_training_helper(  # pylint: disable=invalid-name
      inputs,
      sequence_length,
      embedding=None,
      time_major=False,
      name=None,
  ):
      """Returns an instance of :tf_main:`TrainingHelper
      <contrib/seq2seq/TrainingHelper>` given embeddings.
  
      Args:
          inputs: If :attr:`embedding` is given, this is sequences of input
              token indexes. If :attr:`embedding` is `None`, this is passed to
              TrainingHelper directly.
          sequence_length (1D Tensor): Lengths of input token sequences.
          embedding (optional): The `params` argument of
              :tf_main:`tf.nn.embedding_lookup
              <nn/embedding_lookup>` (e.g., the embedding Tensor); or a callable
              that takes a vector of integer indexes and returns respective
              embedding (e.g., an instance of subclass of
              :class:`~texar.tf.modules.EmbedderBase`).
          time_major (bool): Whether the tensors in `inputs` are time major.
              If `False` (default), they are assumed to be batch major.
          name (str, optional): Name scope for any created operations.
  
      Returns:
          An instance of TrainingHelper.
  
      Raises:
          ValueError: if `sequence_length` is not a 1D tensor.
      """
      if embedding is None:
          return TrainingHelper(
              inputs=inputs,
              sequence_length=sequence_length,
              time_major=time_major,
              name=name,
          )
  
      with tf.name_scope(name, "TrainingHelper", [embedding, inputs]):
          if callable(embedding):
              embedding_fn = embedding
          else:
              embedding_fn = lambda ids: tf.nn.embedding_lookup(
                  embedding, ids
              )
          emb_inputs = embedding_fn(inputs)
      helper = TrainingHelper(
          inputs=emb_inputs,
          sequence_length=sequence_length,
          time_major=time_major,
          name=name,
      )
      return helper
  
imports: import tensorflow
  from tensorflow.python.ops import array_ops
  from tensorflow_probability import distributions
  from texar.tf.modules.decoders.tf_helpers import Helper, TrainingHelper, GreedyEmbeddingHelper
  from texar.tf.modules.embedders.embedder_utils import soft_embedding_lookup
  from texar.tf.utils import utils
label_desc: Use image node_id 4 for calling a global function with example usage: _get_training_helper(inputs, sequence_length, embedding, time_major, name) and returns: helper, TrainingHelper