def _safe_reshape(arr, new_shape):
 if isinstance(arr, ABCSeries):
  arr = arr._values
 if (not isinstance(arr, Categorical)):
  arr = arr.reshape(new_shape)
 return arr

def _safe_reshape ( arr , new_shape ) : if isinstance ( arr , ABCSeries ) : arr = arr . _values if ( not isinstance ( arr , Categorical ) ) : arr = arr . reshape ( new_shape ) return arr
if possible .