code: def test_length_penalty():
      lengths = pt.tensor([[1], [2], [3]])
      length_penalty = sockeye.beam_search.LengthPenalty(0.2, 5.0)
      expected_lp = pt.tensor(
          [
              [6**0.2 / 6**0.2],
              [7**0.2 / 6**0.2],
              [8**0.2 / 6**0.2],
          ]
      )
      pt.testing.assert_close(length_penalty(lengths), expected_lp)
  
imports: from typing import List, Optional
  from typing import Tuple
  import numpy
  import pytest
  import torch
  import numpy
  import sockeye.beam_search
  import sockeye.constants
  import sockeye.lexicon
  import sockeye.utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_length_penalty() without return types