Following on from my demonstration of using power assertions to avoid sleep, I've created KSPowerAssertion, a simple Cocoa wrapper.
The wrapper is almost laughably small. In fact half the reason I've created it is that it makes a great demo of how to use NSError to wrap error codes received from a lower level API.
So either of the above paragraphs describe something you need or are interested in? Grab the code. Standard BSD license, of course.