Indent and check os.environ first.

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>