def squeeze_axes(shape, axes, skip='XY'):
 if (len(shape) != len(axes)):
  raise ValueError('dimensions of axes and shape do not match')
 (shape, axes) = zip(*(i for i in zip(shape, axes) if ((i[0] > 1) or (i[1] in skip))))
 return (tuple(shape), ''.join(axes))

def squeeze_axes ( shape , axes , skip = 'XY' ) : if ( len ( shape ) != len ( axes ) ) : raise ValueError ( 'dimensions of axes and shape do not match' ) ( shape , axes ) = zip ( * ( i for i in zip ( shape , axes ) if ( ( i [ 0 ] > 1 ) or ( i [ 1 ] in skip ) ) ) ) return ( tuple ( shape ) , '' . join ( axes ) )
return shape and axes with single-dimensional entries removed .