code: def validate_walk(self, g, walk, start, length, mode="out"):
      self.assertEqual(len(walk), length + 1)
  
      prev = None
      for vertex in walk:
          if prev is not None:
              self.assertTrue(vertex in g.neighbors(prev, mode=mode))
          else:
              self.assertEqual(start, vertex)
          prev = vertex
  
file_path: python-igraph/tests/test_walks.py
imports: import random
  import unittest
  from igraph import Graph, InternalError
label_desc: Use image node_id 2 for calling the RandomWalkTests obj's underlying member method code with example usage: obj.validate_walk(g, walk, start, length, mode) without return types