def _dedent(text):
    """Like `textwrap.dedent()` but only supports space indents."""
    indents = []
    for line in text.splitlines():
        stripped = line.lstrip(" ")
        if stripped:
            indents.append(len(line) - len(stripped))
    if not indents:
        return text
    indent = min(indents)
    result = []
    for line in text.splitlines(True):
        if line.startswith(" " * indent):
            line = line[indent:]
        result.append(line)
    return "".join(result)