<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def close_alert(self, ignore_exception=False):
 """ JS alerts all blocking. This method closes it. If there is no alert, method raises exception. In tests is good to call this method with ``ignore_exception`` setted to ``True`` which will ignore any exception. """

        try:
            alert = self.get_alert()
            alert.accept()
        except:
            if not ignore_exception:
                raise