from textwrap import dedent


def make_check_stderr_message(stderr, line, reason):
    """
    Create an exception message to use inside check_stderr().
    """
    return dedent("""\
    {reason}:
     Caused by line: {line!r}
     Complete stderr: {stderr}
    """).format(stderr=stderr, line=line, reason=reason)