code: def is_valid(g):
      # Check if g is a cycle having 10-20 nodes.
      def _get_previous(i, v_max):
          if i == 0:
              return v_max
          else:
              return i - 1
  
      def _get_next(i, v_max):
          if i == v_max:
              return 0
          else:
              return i + 1
  
      size = g.num_nodes()
  
      if size < 10 or size > 20:
          return False
      for node in range(size):
          neighbors = g.successors(node)
  
          if len(neighbors) != 2:
              return False
          if _get_previous(node, size - 1) not in neighbors:
              return False
          if _get_next(node, size - 1) not in neighbors:
              return False
      return True
  
imports: import os
  import dgl
  import torch.nn
  import torch
  from functools import partial
  import torch.nn.functional
  from torch.distributions import Bernoulli
  from torch.distributions import Categorical
  import torch.utils.model_zoo
label_desc: Use image node_id 4 for calling a global function with example usage: is_valid(g) and returns: True, False, v_max, unknown, int, unknown, False, False, False