human
Complete this python program:
def _setAcceptableProtocols(context, acceptableProtocols):
assistant
#Here is the Python code you requested.

    """Called to set up the L{OpenSSL.SSL.Context} for doing NPN and/or ALPN
    negotiation.
    @param context: The context which is set up.
    @type context: L{OpenSSL.SSL.Context}
    @param acceptableProtocols: The protocols this peer is willing to speak
    after the TLS negotiation has completed, advertised over both ALPN and
    NPN. If this argument is specified, and no overlap can be found with
    the other peer, the connection will fail to be established. If the
    remote peer does not offer NPN or ALPN, the connection will be
    established, but no protocol wil be negotiated. Protocols earlier in
    the list are preferred over those later in the list.
    @type acceptableProtocols: L{list} of L{bytes}
    """
    def protoSelectCallback(conn, protocols):
        '\n                                NPN    client-side    and    ALPN    server-side    callback    used    to    select\n                                the    next    protocol.    Prefers    protocols    found    earlier    in\n                                C{_acceptableProtocols}.\n\n                                @param    conn:    The    context    which    is    set    up.\n                                @type    conn:    L{OpenSSL.SSL.Connection}\n\n                                @param    conn:    Protocols    advertised    by    the    other    side.\n                                @type    conn:    L{list}    of    L{bytes}\n                                '
        overlap = (set(protocols) & set(acceptableProtocols))
        for p in acceptableProtocols:
            if (p in overlap):
                return p
        else:
            return ''
    if (not acceptableProtocols):
        return
    supported = protocolNegotiationMechanisms()
    if (supported & ProtocolNegotiationSupport.NPN):
        def npnAdvertiseCallback(conn):
            return acceptableProtocols
        context.set_npn_advertise_callback(npnAdvertiseCallback)
        context.set_npn_select_callback(protoSelectCallback)
    if (supported & ProtocolNegotiationSupport.ALPN):
        context.set_alpn_select_callback(protoSelectCallback)
        context.set_alpn_protos(acceptableProtocols)