human
Complete this python program:
def make_capture_protocol():
assistant
#Here is the Python code you requested.

    """Return a ``Deferred``, and a ``Protocol`` which will capture bytes and fire
    the ``Deferred`` when its connection is lost.
    :returns: A 2-tuple of ``Deferred`` and ``Protocol`` instance.
    :rtype: tuple
    """
    d = Deferred()
    captured_data = []
    class Recorder(Protocol, ):
        def dataReceived(self, data):
            captured_data.append(data)
        def connectionLost(self, reason):
            if reason.check(ConnectionDone):
                d.callback(''.join(captured_data))
            else:
                d.errback(reason)
    return (d, Recorder())