code: def assertMembershipsEqual(self, observed, expected):
      if hasattr(observed, "membership"):
          observed = observed.membership
      if hasattr(expected, "membership"):
          expected = expected.membership
      self.assertEqual(
          self.reindexMembership(expected),
          self.reindexMembership(observed),
      )
  
imports: import math
  import random
  import unittest
  from igraph import Clustering, CohesiveBlocks, Cover, Graph, Histogram, InternalError, UniqueIdGenerator, VertexClustering, compare_communities, split_join_distance, set_random_number_generator
label_desc: Use image node_id 2 for calling the CommunityTests obj's underlying member method code with example usage: obj.assertMembershipsEqual(observed, expected) without return types