def setNonBlocking(fd):
    """
    Set the file description of the given file descriptor to non-blocking.
    """
    flags = fcntl.fcntl(fd, fcntl.F_GETFL)
    flags = flags | os.O_NONBLOCK
    fcntl.fcntl(fd, fcntl.F_SETFL, flags)

    Set the file description of the given file descriptor to non-blocking.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/fdesc.py