def _getpass(prompt):
    """
    Helper to turn IOErrors into KeyboardInterrupts.
    """
    import getpass
    try:
        return getpass.getpass(prompt)
    except IOError as e:
        if e.errno == errno.EINTR:
            raise KeyboardInterrupt
        raise
    except EOFError:
        raise KeyboardInterrupt

    Helper to turn IOErrors into KeyboardInterrupts.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/util.py