code: def _unshift_target_factors(
      sequence: np.ndarray, fill_last_with: int = C.EOS_ID
  ):
      """
      Shifts back target factors so that they re-align with the words.
  
      :param sequence: Array of word ids. Shape: (bucketed_length, num_target_factors).
      """
      if len(sequence.shape) == 1 or sequence.shape[1] == 1:
          return sequence.tolist()
      num_factors_to_shift = sequence.shape[1] - 1
      _fillvalue = num_factors_to_shift * [fill_last_with]
      _words = sequence[:, 0].tolist()  # tokens from t==0 onwards
      _next_factors = sequence[
          1:, 1:
      ].tolist()  # factors from t==1 onwards
      sequence = [(w, *fs) for w, fs in itertools.zip_longest(_words, _next_factors, fillvalue=_fillvalue)]  # type: ignore
      return sequence
  
imports: import copy
  import itertools
  import json
  import logging
  from dataclasses import dataclass
  from functools import partial
  from typing import Any, Callable, Dict, Generator, List, Optional, Set, Tuple, Union
  import numpy
  import torch
  from .None import constants
  from .None import lexicon
  from .None import utils
  from .None import vocab
  from .beam_search import CandidateScorer, get_search_algorithm, GreedySearch, SearchResult
  from .data_io import tokens2ids, get_prepended_token_length
  from .model import SockeyeModel
label_desc: Use image node_id 15 for calling a global function with example usage: _unshift_target_factors(sequence, fill_last_with) and returns: sequence, sequence