def input_pad_to_len(words, padded_word_len, word_padding=0):
    """Pad words to 'padded_word_len' with padding if 'len(words) < padded_word_len'.
    Example:
        target_pad_to_len([1, 2, 3], 5, -1) == [1, 2, 3, -1, -1]
    Args:
        words (list): List of the word index.
        padded_word_len (int): The length for padding a batch of sequences to the same length. 
        word_padding (int): The index used to pad.
    """
    if len(words) < padded_word_len:
        words += [word_padding] * (padded_word_len - len(words))
    elif len(words) > padded_word_len:
        words = words[:padded_word_len]
    else:
        pass
    return words