code: def assert_rank(tensor, name, ranks):
      if tensor is not None:
          if isinstance(ranks, int):
              ranks = [ranks]
          assert isinstance(ranks, list)
          rank = len(tensor.shape)
          if rank not in ranks:
              raise ValueError(
                  f"{name}'s rank is invalid (Expected one of {ranks}, got {rank})"
              )
  
imports: import numpy
  import time
  import torch
label_desc: Use image node_id 3 for calling a global function with example usage: assert_rank(tensor, name, ranks) without return types