def client_extensions_handshake(accepted: List[str], supported: List[Extension]) -> List[Extension]:
    extensions = []
    for accept in accepted:
        name = accept.split(';', 1)[0].strip()
        for extension in supported:
            if (extension.name == name):
                extension.finalize(accept)
                extensions.append(extension)
                break
        else:
            raise RemoteProtocolError('unrecognized extension {}'.format(name), event_hint=RejectConnection())
    return extensions
def client_extensions_handshake(accepted: List[str], supported: List[Extension]) -> List[Extension]:
    extensions = []
    for accept in accepted:
        name = accept.split(';', 1)[0].strip()
        for extension in supported:
            if (extension.name == name):
                extension.finalize(accept)
                extensions.append(extension)
                break
        else:
            raise RemoteProtocolError('unrecognized extension {}'.format(name), event_hint=RejectConnection())
    return extensions