docs: def assert_join_compatibility(rel1, rel2):
      """
      Determine if expressions rel1 and rel2 are join-compatible.  To be join-compatible, the matching attributes
      in the two expressions must be in the primary key of one or the other expression.
      Raises an exception if not compatible.
      :param rel1: A QueryExpression object
      :param rel2: A QueryExpression object
      """
      for rel in (rel1, rel2):
          if not isinstance(rel, (U, QueryExpression)):
              raise DataJointError('Object %r is not a QueryExpression and cannot be joined.' % rel)
      if not isinstance(rel1, U) and not isinstance(rel2, U):  # dj.U is always compatible
          try:
              raise DataJointError("Cannot join query expressions on dependent attribute `%s`" % next(r for r in set(
                  rel1.heading.dependent_attributes).intersection(rel2.heading.dependent_attributes)))
          except StopIteration:
              pass