def makeFakeKQueue(testKQueue, testKEvent):
    """
    Create a fake that implements L{_IKQueue}.

    @param testKQueue: Something that acts like L{select.kqueue}.
    @param testKEvent: Something that acts like L{select.kevent}.
    @return: An implementation of L{_IKQueue} that includes C{testKQueue} and
        C{testKEvent}.
    """
    @implementer(_IKQueue)
    class FakeKQueue(object):
        kqueue = testKQueue
        kevent = testKEvent

    return FakeKQueue()

    Create a fake that implements L{_IKQueue}.

    @param testKQueue: Something that acts like L{select.kqueue}.
    @param testKEvent: Something that acts like L{select.kevent}.
    @return: An implementation of L{_IKQueue} that includes C{testKQueue} and
        C{testKEvent}.
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_kqueuereactor.py