<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_critical(self, crit=True):
 """ Return list of critical extensions (or list of non-cricital, if optional second argument is False """

        if crit:
            flag = 1
        else:
            flag = 0
        found = []
        end = len(self)
        index = -1
        while True:
            index = libcrypto.X509_get_ext_by_critical(self.cert.cert, flag,
                                                       index)
            if index >= end or index < 0:
                break
            found.append(self[index])
        return found