import bisect


def pvd_classify(val, bins):
	"""Identify the bin(range) a value belongs to given a list of boundaries

	Keyword arguments:
	val -- the value to be placed in a bin
	bins -- a list containing the bin boundaries"""

	val = abs(val)
	pos = bisect.bisect_right(bins, val)
	lower_bound = bins[pos - 1]
	upper_bound = bins[pos] - 1
	return lower_bound, upper_bound