code: def token_post(ls):
      lengths = [len(l[0]) for l in ls]
  
      length = max(lengths)
      out = [l[0] + ([0] * (length - len(l[0]))) for l in ls]
  
      lengths2 = [max(l[1]) + 1 for l in ls]
      length2 = max(lengths2)
      out2 = torch.zeros(len(ls), length, length2)
      for b, l in enumerate(ls):
          for i, w in enumerate(l[1]):
              if w != -1:
                  out2[b, i, w] = 1
      return torch.LongTensor(out), out2.long(), lengths
  
imports: import torchtext
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: token_post(ls) and returns: torch,  out2,  lengths