def contour(z, x=None, y=None, filled=None, xlim=None, ylim=None, xinvert=
    False, yinvert=False, xlog=False, ylog=False, title=None, xlabel=None,
    ylabel=None, lab_loc=0, ax=None, grid=None, plot_kw={}, **kwargs):
    """Level contour plotting function.
	
	This is a wrapper for pyplot.contour() and pyplot.contourf().
	
	Parameters
	----------
	z : array-like
		The height values to draw the contours.
	x : array-like, optional
		Position of data points in the x axis.
	y : array-like, optional
		Position of data points in the y axis.
	filled: boolean, optional
		If True, draws filled contours. If not given defaults to the value defined in splotch.Params.
	xlim : tuple-like, optional
		Defines the limits of the x-axis, it must contain two elements (lower and higer limits).
	ylim : tuple-like, optional
		Defines the limits of the y-axis, it must contain two elements (lower and higer limits).
	xinvert : bool, optional
		If True, inverts the x-axis.
	yinvert : bool, optional
		If True, inverts the y-axis.
	xlog : bool, optional
		If True, the scale of the x-axis is logarithmic. If not given defaults to the value defined in splotch.Params.
	ylog : bool, optional
		If True, the scale of the x-axis is logarithmic. If not given defaults to the value defined in splotch.Params.
	title : str, optional
		Sets the title of the plot
	xlabel : str, optional
		Sets the label of the x-axis.
	ylabel : str, optional
		Sets the label of the y-axis.
	lab_loc : int, optional
		Defines the position of the legend
	ax : pyplot.Axes, optional
		Use the given axes to make the plot, defaults to the current axes.
	grid : boolean, optional
		If not given defaults to the value defined in splotch.Params.
	output : boolean, optional
		If True, returns the edges and values of the underlying histogram plus the levels of the contours.
	plot_kw : dict, optional
		Passes the given dictionary as a kwarg to the plotting function. Valid kwargs are QuadContourSet properties.
	**kwargs: QuadContourSet properties, optional
		kwargs are used to specify matplotlib specific properties such as cmap, linewidths, hatches, etc.
		The list of available properties can be found here: 
		https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.contour.html
	
	Returns
	-------
	bin_edges_x : array
		The bin edges for the x axis.
	bin_edges_y : array
		The bin edges for the y axis.
	n : array
		The values of the underlying histogram.
	l : array
		The levels for the contours.
	"""
    from numpy import shape, linspace
    from matplotlib.pyplot import contour, contourf, legend
    from .base_func import axes_handler, dict_splicer, plot_finalizer
    if ax is not None:
        old_axes = axes_handler(ax)
    if filled is None:
        from .defaults import Params
        filled = Params.cont_filled
    if x is None:
        x = linspace(0, 1, z.shape[0])
    if y is None:
        y = linspace(0, 1, z.shape[1])
    plot_par = plot_kw.copy()
    plot_par.update(kwargs)
    plotf = {(False): contour, (True): contourf}
    plotf[filled](x, y, z, **plot_par)
    plot_finalizer(xlog, ylog, xlim, ylim, title, xlabel, ylabel, xinvert,
        yinvert, grid)
    if ax is not None:
        old_axes = axes_handler(old_axes)
