code: def get_relation_count_query(self, query, parent):
          
          if parent.get_query().from__ == query.get_query().from__:
              return self.get_relation_count_query_for_self_join(query, parent)
  
          self._set_join(query)
  
          return super(BelongsToMany, self).get_relation_count_query(query, parent)
docs: Add the constraints for a relationship count query.
  
          :type query: orator.orm.Builder
          :type parent: orator.orm.Builder
  
          :rtype: orator.orm.Builder