def METHOD_NAME(y, x, bins=20, statistic='mean'):
	'''Create a profile of y(x) in the specified bins.
	Parameters
	----------
	y : array_like
		The y-coordinates of the data points. This should be 1-dimensional.
	x : array_like
		The x-coordinates of the data points. This should be 1-dimensional
		and the same size as `y`.
	bins : array_like or integer
		The bin edges of the profile. If this is an integer, `bins` is the
		number of bins that will be equally distributed along the whole range
		of `x`.
	statistic : string
		The statistic to compute (default is 'mean').
		The following statistics are available:
		* 'mean': compute the mean of values for points within the bin edges while ignoring NaN values.
		* 'sum': compute the sum of values for points within the bin edges while ignoring NaN values.
		* 'min': compute the minimum of values for points within the bin edges while ignoring NaN values.
		* 'max': compute the maximum of values for points within the bin edges while ignoring NaN values.
		* 'std': compute the standard deviation of values for points within the bin edges while ignoring NaN values.
		* 'var': compute the variance of values for points within the bin edges while ignoring NaN values.
	Returns
	-------
	bin_centers : array_like
		The center of each of the bins.
	profile : array_like
		The y-values of the resulting profile.
	std_profile : array_like
		The standard deviation within each bin.
	num_per_bin : array_like
		The number of samples per bin.
	Raises
	------
	RuntimeError
		If the number of bins are negative or zero.
	ValueError
		If the statistic is not implemented.
	'''
	if np.isscalar(bins):
		if bins <= 0:
			raise RuntimeError('The number of bins should be positive.')
		# Equally space the bins.
		bins = np.linspace(np.min(x), np.max(x), bins + 1)
	bin_centers = (bins[1:] + bins[:-1]) / 2
	num_bins = len(bin_centers)
	num_per_bin = np.histogram(x, bins)[0]
	which_bin = np.digitize(x, bins)
	statistics = {'mean': np.nanmean, 'median': np.nanmedian, 'max': np.nanmax, 'min': np.nanmin, 'std': np.nanstd, 'var': np.nanvar}
	if statistic not in statistics:
		raise ValueError('Statistic %s not implemented.' % statistic)
	func = statistics[statistic]
	profile = np.array([func(y[which_bin == b]) for b in range(1, num_bins + 1)])
	std_profile = np.array([np.nanstd(y[which_bin == b]) for b in range(1, num_bins + 1)])
	return bin_centers, profile, std_profile, num_per_bin