Function to print command-line usage for a program
You can use textwrap.dedent to remove common whitespace from the start of all lines in a multiline string:

&gt;&gt;&gt; import textwrap
&gt;&gt;&gt; print(textwrap.dedent(
        """
        Usage examples:
        Test deployment:
            $ fab [noinput] test deploy
        Staging deployment:
            $ fab [noinput] staging deploy
        Production deployment:
            $ fab [noinput] production deploy
        """
))

Usage examples:
Test deployment:
    $ fab [noinput] test deploy
Staging deployment:
    $ fab [noinput] staging deploy
Production deployment:
    $ fab [noinput] production deploy


As it says in the docs:


  This can be used to make triple-quoted strings line up with the left edge of the display, while still presenting them in the source code in indented form.