def _get_reason(cluster_or_step):
 return getattr(getattr(cluster_or_step.status, 'statechangereason', ''), 'message', '').rstrip()

def _get_reason ( cluster_or_step ) : return getattr ( getattr ( cluster_or_step . status , 'statechangereason' , '' ) , 'message' , '' ) . rstrip ( )
extract statechangereason .