code: def same_lineage(o1, o2):
      '''Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).'''
      def comp(x, y):
          return issubclass(x, y) or issubclass(y, x)
  
      if isinstance(o1, type) and isinstance(o2, type):
          return comp(o1, o2)
      elif not (isinstance(o1, type) or isinstance(o2, type)):
          return comp(type(o1), type(o2))
      raise TypeError("Cannot compare type and object"f same_lineage(o1, o2):
      '''Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).'''
      def comp(x, y):
          return issubclass(x, y) or issubclass(y, x)
  
      if isinstance(o1, type) and isinstance(o2, type):
          return comp(o1, o2)
      elif not (isinstance(o1, type) or isinstance(o2, type)):
          return comp(type(o1), type(o2))
      raise TypeError("Cannot compare type and object")
docs: Returns True iff o1 and o2 are of the same class lineage (that is, a direct line of descent, without branches).