'Helper for .has()'

def _has_matcher(self):

    def _ncsplit(expr):
        (cpart, ncpart) = ([], [])
        for arg in expr.args:
            if arg.is_commutative:
                cpart.append(arg)
            else:
                ncpart.append(arg)
        return (set(cpart), ncpart)
    (c, nc) = _ncsplit(self)
    cls = self.__class__
    def is_in(expr):
        if (expr == self):
            return True
        elif (not isinstance(expr, Basic)):
            return False
        elif isinstance(expr, cls):
            (_c, _nc) = _ncsplit(expr)
            if ((c & _c) == c):
                if (not nc):
                    return True
                elif (len(nc) <= len(_nc)):
                    for i in range((len(_nc) - len(nc))):
                        if (_nc[i:(i + len(nc))] == nc):
                            return True
        return False
    return is_in
