def _verify_picture_index(index):
 if (not (isinstance(index, tuple) and (len(index) == 2))):
  raise IndexError('Expected 2D index but got {0!r}'.format(index))
 if all((isinstance(i, int) for i in index)):
  return index
 index = list(index)
 for (i, dim_slice) in enumerate(index):
  if isinstance(dim_slice, int):
   index[i] = dim_slice = slice(dim_slice, (dim_slice + 1))
 return tuple(index)

def _verify_picture_index ( index ) : if ( not ( isinstance ( index , tuple ) and ( len ( index ) == 2 ) ) ) : raise IndexError ( 'Expected 2D index but got {0!r}' . format ( index ) ) if all ( ( isinstance ( i , int ) for i in index ) ) : return index index = list ( index ) for ( i , dim_slice ) in enumerate ( index ) : if isinstance ( dim_slice , int ) : index [ i ] = dim_slice = slice ( dim_slice , ( dim_slice + 1 ) ) return tuple ( index )
raise error if picture index is not a 2d index/slice .