The rgb function is incomplete. Complete it so that passing in RGB decimal values will result in a hexadecimal representation being returned. Valid decimal values for RGB are 0 - 255. Any values that fall out of that range must be rounded to the closest valid value.

Note: Your answer should always be 6 characters long, the shorthand with 3 will not work here.

The following are examples of  expected output values:
```python
rgb(255, 255, 255) # returns FFFFFF
rgb(255, 255, 300) # returns FFFFFF
rgb(0,0,0) # returns 000000
rgb(148, 0, 211) # returns 9400D3
```
```if:nasm

char \*rgb(int r, int g, int b, char \*outp)

```

Source: codewars | Difficulty: EASY

Starter code: def rgb(r, g, b):
	

Solutions:
def rgb(r, g, b):
	round = lambda x: min(255, max(x, 0))
	return ('{:02X}' * 3).format(round(r), round(g), round(b))


def limit(num):
	if num < 0:
		return 0
	if num > 255:
		return 255
	return num

def rgb(r, g, b):
	return '{:02X}{:02X}{:02X}'.format(limit(r), limit(g), limit(b))


def rgb(r, g, b):
	clamp = lambda x: max(0, min(x, 255))
	return '%02X%02X%02X' % (clamp(r), clamp(g), clamp(b))


def rgb(*args):
	return ''.join(map(lambda x: '{:02X}'.format(min(max(0, x), 255)), args))


def rgb(r, g, b):

	def get_hex(s):
		if s > 255:
			s = 255
		if s < 0:
			s = 0
		return hex(s)[2:].upper() if len(hex(s)[2:]) > 1 else '0' + hex(s)[2:]
	return get_hex(r) + get_hex(g) + get_hex(b)


def rgb(r, g, b):
	return ''.join(['%02X' % max(0, min(x, 255)) for x in [r, g, b]])


def hex_con(color):
	hex_dict = '0123456789ABCDEF'
	d1 = color // 16
	d2 = color % 16
	if d1 > 15:
		d1 = 15
		d2 = 15
	elif d1 < 0:
		d1 = 0
		d2 = 0
	return str(hex_dict[d1]) + str(hex_dict[d2])

def rgb(r, g, b):
	R = hex_con(r)
	G = hex_con(g)
	B = hex_con(b)
	return R + G + B


def rgb(r, g, b):
	if not type(r).__name__ == 'int':
		raise TypeError("'r' is not of type int")
	if not type(g).__name__ == 'int':
		raise TypeError("'g' is not of type int")
	if not type(b).__name__ == 'int':
		raise TypeError("'b' is not of type int")
	return '{r:02X}{g:02X}{b:02X}'.format(r=saturate(r), g=saturate(g), b=saturate(b))

def saturate(x):
	if not type(x).__name__ == 'int':
		raise TypeError('given value is not of type int')
	x = 0 if x < 0 else x
	x = 255 if x > 255 else x
	return x

def __starting_point():
	import doctest
	doctest.testmod()
__starting_point()


def rgb(r, g, b):
	return '{0:02X}{1:02X}{2:02X}'.format(max(min(r, 255), 0), max(min(g, 255), 0), max(min(b, 255), 0))