Serve with a piece of toasted baguette at the bottom of each bowl. Finish with cheese on top.
In a heavy pot, melt the butter and then add the onions. Cook very slowly over a low heat for about an hour, stirring occasionally, until the onions are very soft and somewhat darkened.
Stir in the sugar until dissolved. Stir in the flour and mix to coat.
Add the broth (or water and wine). Add pepper to taste and simmer for at least 30 minutes, preferably longer.
Serve with a hunk of toasted bread in the bottom of each bowl. Sprinkle cheese on top, and if you have oven-safe dishes, brown under the broiler to form a skin on top of the soup.