def _normalized_indent(text):
    """Returns `text` with normalized indentation."""
    lines = text.strip().split('\n')
    head = lines[0]
    rest = lines[1:]
    if rest:
        indent = 0
        for line in rest:
            contents = line.lstrip()
            if contents:
                indent = len(line) - len(contents)
                break
        if indent:
            lines = [head] + [line[indent:] for line in rest]
    return '\n'.join(lines)
