def auto_undent(string):
    """
    Unindent a docstring.
    """
    lines = string.splitlines()
    while lines[0].strip() == '':
        lines = lines[1:]
        if not lines:
            return []
    spaces = len(lines[0]) - len(lines[0].lstrip(' '))
    out = []
    for line in lines:
        num_spaces = len(line) - len(line.lstrip(' '))
        out.append(line[min(spaces, num_spaces):])
    return out
