Return a copy of the string with each line indented by 4 spaces. The
    first line and blank lines are not indented by default.

    :param width: Number of spaces to indent by.
    :param first: Don't skip indenting the first line.
    :param blank: Don't skip indenting empty lines.

    .. versionchanged:: 2.10
        Blank lines are not indented by default.

        Rename the ``indentfirst`` argument to ``first``.

def do_indent(
    s, width=4, first=False, blank=False, indentfirst=None
):
    """Return a copy of the string with each line indented by 4 spaces. The
    first line and blank lines are not indented by default.

    :param width: Number of spaces to indent by.
    :param first: Don't skip indenting the first line.
    :param blank: Don't skip indenting empty lines.

    .. versionchanged:: 2.10
        Blank lines are not indented by default.

        Rename the ``indentfirst`` argument to ``first``.
    """
    if indentfirst is not None:
        warnings.warn(DeprecationWarning(
            'The "indentfirst" argument is renamed to "first".'
        ), stacklevel=2)
        first = indentfirst

    s += u'\n'  # this quirk is necessary for splitlines method
    indention = u' ' * width

    if blank:
        rv = (u'\n' + indention).join(s.splitlines())
    else:
        lines = s.splitlines()
        rv = lines.pop(0)

        if lines:
            rv += u'\n' + u'\n'.join(
                indention + line if line else line for line in lines
            )

    if first:
        rv = indention + rv

    return rv