def binsizeToResolution(binsize):
    """Return the resolution unit from the bin size

	It is a convenient function to convert binsize into resolution unit.
	It has a support of base (b), kilobase (kb), megabase (mb) and
	gigabase (gb) unit. It also convert binsize to decimal resolution unit as
	shown below in examples.

	Parameters
	----------

	binsize:	int
		bin size

	Returns
	-------
	resolution : str
		resolution unit

	Examples
	--------
		>>> binsizeToResolution(1)
		'1b'
		>>> binsizeToResolution(10)
		'10b'
		>>> binsizeToResolution(10000)
		'10kb'
		>>> binsizeToResolution(100000)
		'100kb'
		>>> binsizeToResolution(125500)
		'125.5kb'
		>>> binsizeToResolution(1000000)
		'1mb'
		>>> binsizeToResolution(1634300)
		'1.6343mb'

	"""
    suffix = {(0): 'b', (1): 'kb', (2): 'mb', (3): 'gb'}
    rest = None
    count = 0
    while 1:
        rest = binsize / 1000 ** count
        if rest >= 1000:
            count += 1
        else:
            break
    if rest - int(rest) == 0:
        resolution = str(int(rest)) + suffix[count]
    else:
        resolution = str(rest) + suffix[count]
    return resolution
