Return list of extensions with given Oid

def find(self, oid):
        """
        Return list of extensions with given Oid
        """
        if not isinstance(oid, Oid):
            raise TypeError("Need crytypescrypto.oid.Oid as argument")
        found = []
        index = -1
        end = len(self)
        while True:
            index = libcrypto.X509_get_ext_by_NID(self.cert.cert, oid.nid,
                                                  index)
            if index >= end or index < 0:
                break
            found.append(self[index])
        return found