Does this not create extra space if nothing is defined ' '.join(['','']) ==> ' '

Would it be better to assume you will always have body if you have header .. so the body string could be ' body %s' and you could return a string concatenation ?