import textwrap


def indent(text, spaces=0, first_line=False):
    """
    Indent the text by the given number of white spaces.
    """
    prefix = ' ' * spaces
    if first_line:
        return textwrap.indent(text, prefix)

    return ("\n" + prefix).join(text.splitlines())