def is_inside_except(node):
 current = node
 while (current and (not isinstance(current.parent, astroid.ExceptHandler))):
  current = current.parent
 return (current and (current is current.parent.name))

def is_inside_except ( node ) : current = node while ( current and ( not isinstance ( current . parent , astroid . ExceptHandler ) ) ) : current = current . parent return ( current and ( current is current . parent . name ) )
returns true if node is inside the name of an except handler .