code: def add_constraints(self):
          
          if self._constraints:
              foreign_key = getattr(self._parent, self._foreign_key, None)
              if foreign_key is None:
                  self._query = None
              else:
                  table = self._related.get_table()
  
                  self._query.where(
                      "{}.{}".format(table, self._other_key), "=", foreign_key
                  )
docs: Set the base constraints on the relation query.
  
          :rtype: None