':see Expression.findtype()'

def findtype(self, variable):

    assert isinstance(variable, Variable), (u'%s    is    not    a    Variable' % variable)
    if self.is_atom():
        (function, args) = self.uncurry()
    else:
        function = self.function
        args = [self.argument]
    found = [arg.findtype(variable) for arg in ([function] + args)]
    unique = []
    for f in found:
        if (f != ANY_TYPE):
            if unique:
                for u in unique:
                    if f.matches(u):
                        break
            else:
                unique.append(f)
    if (len(unique) == 1):
        return list(unique)[0]
    else:
        return ANY_TYPE
