code: def is_seq_of(seq, expected_type, seq_type=None):
      """Check whether it is a sequence of some type.
      Args:
          seq (Sequence): The sequence to be checked.
          expected_type (type): Expected type of sequence items.
          seq_type (type, optional): Expected sequence type.
      Returns:
          bool: Whether the sequence is valid.
      """
      if seq_type is None:
          exp_seq_type = abc.Sequence
      else:
          assert isinstance(seq_type, type)
          exp_seq_type = seq_type
      if not isinstance(seq, exp_seq_type):
          return False
      for item in seq:
          if not isinstance(item, expected_type):
              return False
      return True
  
imports: import numpy
  import matplotlib.pyplot
  from mpl_toolkits.mplot3d import Axes3D
  import random
  import torch
  import torch.nn
  import torch.nn.functional
  import os
  from collections import abc
label_desc: Use image node_id 7 for calling a global function with example usage: is_seq_of(seq, expected_type, seq_type) and returns: True, False, False