<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_diag(self, jac, name):
 """ Check matrix ``jac`` for diagonal elements that equals 0 """

        system = self.system
        pos = []
        names = []
        pairs = ''
        size = jac.size
        diag = jac[0:size[0] ** 2:size[0] + 1]

        for idx in range(size[0]):
            if abs(diag[idx]) <= 1e-8:
                pos.append(idx)

        for idx in pos:
            names.append(system.varname.__dict__[name][idx])

        if len(names) > 0:
            for i, j in zip(pos, names):
                pairs += '{0}: {1}\n'.format(i, j)
            logger.debug('Jacobian diagonal check:')
            logger.debug(pairs)