lightcli.py
def long_input(prompt='Multi-line input\n' + \
        'Enter EOF on a blank line to end ' + \
        '(ctrl-D in *nix, ctrl-Z in windows)',
        maxlines = None, maxlength = None):
    """Get a multi-line string as input"""
    
    lines = []
    print(prompt)
    lnum = 1

    try:
        while True:
            
            if maxlines:
            
                if lnum > maxlines:
                    break
                
                else:
                    if maxlength:
                        lines.append(string_input('')[:maxlength])
                    else:
                        lines.append(string_input(''))
                    lnum += 1
            
            else:
                if maxlength:
                    lines.append(string_input('')[:maxlength])
                else:
                    lines.append(string_input(''))

    except EOFError:
        pass
    finally:
        return '\n'.join(lines)
def long_input(prompt='Multi-line input\n' + \
        'Enter EOF on a blank line to end ' + \
        '(ctrl-D in *nix, ctrl-Z in windows)',
        maxlines = None, maxlength = None):
    """Get a multi-line string as input"""
    
    lines = []
    print(prompt)
    lnum = 1

    try:
        while True:
            
            if maxlines:
            
                if lnum > maxlines:
                    break
                
                else:
                    if maxlength:
                        lines.append(string_input('')[:maxlength])
                    else:
                        lines.append(string_input(''))
                    lnum += 1
            
            else:
                if maxlength:
                    lines.append(string_input('')[:maxlength])
                else:
                    lines.append(string_input(''))

    except EOFError:
        pass
    finally:
        return '\n'.join(lines)
Get a multi-line string as input