_string_re = compile(r'%(\d+)\$([\d\.]*[diufFeEgGxXoscpn%])')
def real_printf(string, values=None):
	if not values:
		return string
	if type(values) not in [tuple, list]:
		values = (values,)
	_string = _string_re.sub('%(\g<1>)\g<2>', string)
	if _string == string:
		return string % values
	else:
		return _string % dict((str(i+1), values[i]) for i in xrange(len(values)))