Automatically indent a whole block of text into str.format
Could textwrap do some of the job?

Particularly the dedent and indent function?  You will still need to count the number of tabs you want, but the rest will be done.