def downtime_formatter(downtime, short_format):
	final_string = ""

	hours = int(math.floor(downtime))

	if hours > 0:
		hour_text = " hour" if hours == 1 else " hours"
		final_string += str(hours) + hour_text

	fractional_hours = downtime - hours

	fractional_minutes = 0

	if fractional_hours > 0:
		total_minutes = fractional_hours * 60
		whole_minutes = int(math.floor(total_minutes))
		fractional_minutes = total_minutes - whole_minutes
		if short_format and fractional_minutes > 0.5:
			whole_minutes += 1

		if whole_minutes > 0:
			final_string += (" " if hours > 0 else
							 "") + str(whole_minutes) + " minute" + (
								 "" if whole_minutes == 1 else "s")

	if fractional_minutes > 0:
		total_seconds = fractional_minutes * 60
		whole_seconds = int(math.floor(total_seconds))
		fractionalSeconds = total_seconds - whole_seconds

		if whole_seconds > 0 and not short_format:
			final_string += (" " if hours > 0 or whole_minutes > 0 else
							 "") + str(whole_seconds) + " second" + (
								 "" if whole_seconds == 1 else "s")
		elif short_format and whole_minutes == 0 and hours == 0:
			final_string += str(whole_seconds) + " second" + (
				"" if whole_seconds == 1 else "s")

	if len(final_string) == 0:
		final_string = "less than a minute"

	return final_string