(Does dedent() base it's behaviour on first (non-empty) line?)
No, it chooses the longest common whitespace prefix in the whole string.
I'm not sure what it does with blank lines. A quick test ... in Python 2.5.5, it ignores them for the purpose of determining the dedent. That is, you can have any amount of whitespace on a blank line, but it doesn't affect the dedent computed.