def _set_contour_locator(vmin, vmax, contours):
 locator = None
 if isinstance(contours, int):
  from matplotlib import ticker
  locator = ticker.MaxNLocator(nbins=(contours + 1))
  contours = locator.tick_values(vmin, vmax)
 return (locator, contours)

def _set_contour_locator ( vmin , vmax , contours ) : locator = None if isinstance ( contours , int ) : from matplotlib import ticker locator = ticker . MaxNLocator ( nbins = ( contours + 1 ) ) contours = locator . tick_values ( vmin , vmax ) return ( locator , contours )
function for setting correct contour levels .