<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def where_exists(self, query, boolean="and", negate=False):
 """ Add an exists clause to the query. :param query: The exists query :type query: Builder or QueryBuilder :type boolean: str :type negate: bool :rtype: Builder """

        if isinstance(query, Builder):
            query = query.get_query()

        self.get_query().where_exists(query, boolean, negate)

        return self