Method to count interior nodes of a binary tree
So after our little discussion, I hope you see that you're missing some key cases here, when the root given is None.

Some things that should be pointed out, when comparing to None, you should be checking if it is or is not None.  Don't use (in)equality here, it is just not correct.

Assuming this is a method on your tree node objects, I'd rewrite this to make use of self.  That way we don't even need to worry about the case when self is None, that just shouldn't happen.

def count_interior_nodes(self):
    count = 0
    hasLeft, hasRight = self.left is not None, self.right is not None
    if hasLeft:
        count += self.left.count_interior_nodes()
    if hasRight:
        count += self.right.count_interior_nodes()
    if (hasLeft or hasRight) and self.parent is not None:
        count += 1
    return count