def check_shared(axs, x_shared, y_shared):
 shared = [axs[0]._shared_x_axes, axs[0]._shared_y_axes]
 for ((i1, ax1), (i2, ax2), (i3, (name, shared))) in zip(enumerate(axs), enumerate(axs), enumerate(zip(u'xy', [x_shared, y_shared]))):
  if (i2 <= i1):
   continue
  assert (shared[i3].joined(ax1, ax2) == shared[(i1, i2)]), (u'axes %i and %i incorrectly %ssharing %s axis' % (i1, i2, (u'not ' if shared[(i1, i2)] else u''), name))

def check_shared ( axs , x_shared , y_shared ) : shared = [ axs [ 0 ] . _shared_x_axes , axs [ 0 ] . _shared_y_axes ] for ( ( i1 , ax1 ) , ( i2 , ax2 ) , ( i3 , ( name , shared ) ) ) in zip ( enumerate ( axs ) , enumerate ( axs ) , enumerate ( zip ( u'xy' , [ x_shared , y_shared ] ) ) ) : if ( i2 <= i1 ) : continue assert ( shared [ i3 ] . joined ( ax1 , ax2 ) == shared [ ( i1 , i2 ) ] ) , ( u'axes %i and %i incorrectly %ssharing %s axis' % ( i1 , i2 , ( u'not ' if shared [ ( i1 , i2 ) ] else u'' ) , name ) )
x_shared and y_shared are n x n boolean matrices; entry indicates whether the x axes of subplots i and j should be shared .