code: def lengths_to_padding_mask(lens):
      bsz, max_lens = lens.size(0), torch.max(lens).item()
      mask = torch.arange(max_lens).to(lens.device).view(1, max_lens)
      mask = mask.expand(bsz, -1) >= lens.view(bsz, 1).expand(
          -1, max_lens
      )
      return mask
  
imports: import contextlib
  import itertools
  import logging
  import re
  import warnings
  from typing import Optional, Tuple
  import math
  import numpy
  import torch
  from fairseq.file_io import PathManager
  from fairseq import utils
  import os
label_desc: Use image node_id 15 for calling a global function with example usage: lengths_to_padding_mask(lens) and returns: mask