def descrFromDoc(obj):
    """
    Generate an appropriate description from docstring of the given object
    """
    if obj.__doc__ is None or obj.__doc__.isspace():
        return None

    lines = [x.strip() for x in obj.__doc__.split("\n")
                             if x and not x.isspace()]
    return " ".join(lines)

    Generate an appropriate description from docstring of the given object
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/_shellcomp.py