announce to the other side that we'd like to negotiate keys, and what
        kind of key negotiation we support.
508225
def _send_kex_init(self):
        
        self.clear_to_send_lock.acquire()
        try:
            self.clear_to_send.clear()
        finally:
            self.clear_to_send_lock.release()
        self.in_kex = True
        if self.server_mode:
            if (self._modulus_pack is None) and ('diffie-hellman-group-exchange-sha1' in self._preferred_kex):
                # can't do group-exchange if we don't have a pack of potential primes
                pkex = list(self.get_security_options().kex)
                pkex.remove('diffie-hellman-group-exchange-sha1')
                self.get_security_options().kex = pkex
            available_server_keys = list(filter(list(self.server_key_dict.keys()).__contains__,
                                                self._preferred_keys))
        else:
            available_server_keys = self._preferred_keys

        m = Message()
        m.add_byte(cMSG_KEXINIT)
        m.add_bytes(os.urandom(16))
        m.add_list(self._preferred_kex)
        m.add_list(available_server_keys)
        m.add_list(self._preferred_ciphers)
        m.add_list(self._preferred_ciphers)
        m.add_list(self._preferred_macs)
        m.add_list(self._preferred_macs)
        m.add_list(self._preferred_compression)
        m.add_list(self._preferred_compression)
        m.add_string(bytes())
        m.add_string(bytes())
        m.add_boolean(False)
        m.add_int(0)
        # save a copy for later (needed to compute a hash)
        self.local_kex_init = m.asbytes()
        self._send_message(m)
913186
def create_ikepolicy(self, name, **kwargs):
        '''
        
        '''
        body = {'name': name}
        if 'phase1_negotiation_mode' in kwargs:
            body['phase1_negotiation_mode'] = kwargs['phase1_negotiation_mode']
        if 'auth_algorithm' in kwargs:
            body['auth_algorithm'] = kwargs['auth_algorithm']
        if 'encryption_algorithm' in kwargs:
            body['encryption_algorithm'] = kwargs['encryption_algorithm']
        if 'pfs' in kwargs:
            body['pfs'] = kwargs['pfs']
        if 'ike_version' in kwargs:
            body['ike_version'] = kwargs['ike_version']
        if 'units' in kwargs:
            body['lifetime'] = {'units': kwargs['units']}
        if 'value' in kwargs:
            if 'lifetime' not in body:
                body['lifetime'] = {}
            body['lifetime']['value'] = kwargs['value']
        return self.network_conn.create_ikepolicy(body={'ikepolicy': body})
541497
public String negotiate(
      SSLSocket sslSocket, String hostname, @Nullable List<Protocol> protocols) throws IOException {
    if (protocols != null) {
      configureTlsExtensions(sslSocket, hostname, protocols);
    }
    try {
      // Force handshake.
      sslSocket.startHandshake();

      String negotiatedProtocol = getSelectedProtocol(sslSocket);
      if (negotiatedProtocol == null) {
        throw new RuntimeException("TLS ALPN negotiation failed with protocols: " + protocols);
      }
      return negotiatedProtocol;
    } finally {
      platform.afterHandshake(sslSocket);
    }
  }
242559
function giveAnswer(answeringPlayer, answer) {
    if(answeringPlayer === seller) return;
    if(answer <= currentBid) return;

    buyer = answeringPlayer;
    currentBid = answer;

    resetTimer();
    notify(false);
  }
789918
def make_key(observer):
        """"""

        if hasattr(observer, "__self__"):
            inst = observer.__self__
            method_name = observer.__name__
            key = (id(inst), method_name)
        else:
            key = id(observer)
        return key
1044478
function keyOptions (key, options) {
  const _key = options._key == null
    ? key
    : options._key + '.' + key
  return Object.assign({}, options, { _key: _key })
}
1024231
def options
      VALID_OPTIONS_KEYS.reduce({}) do |options, key|
        options.merge(key => send(key))
      end
    end
85813
def send_key(self, key):
        
        cmd = struct.pack(">BBBBBBH", 4, 1, 0, 0, 0, 0, key)
        self.con.send(cmd)

        cmd = struct.pack(">BBBBBBH", 4, 0, 0, 0, 0, 0, key)
        self.con.send(cmd)
188360
def negotiate_accept(accept, handlers):
    
    provided = [h.provides for h in handlers]
    if None in provided:
        # Not all handlers are annotated - disable content-negotiation
        # for Accept.
        # TODO: We could implement an "optimistic mode": If a fully qualified
        # mime-type was requested and we have a specific handler that provides
        # it, choose that handler instead of the default handler (depending on
        # 'q' value).
        return [h for h in handlers if h.provides is None]
    else:
        # All handlers are annotated with the mime-type they
        # provide: find the best match.
        #
        # mimeparse.best_match expects the supported mime-types to be sorted
        # in order of increasing desirability. By default, we use the order in
        # which handlers were added (earlier means better).
        # TODO: add "priority" parameter for user-defined priorities.
        best_match = mimeparse.best_match(reversed(provided), accept)
        return [h for h in handlers if h.provides == best_match]
472134
def _translate_key(key):
    

    d = _get_deprecated_option(key)
    if d:
        return d.rkey or key
    else:
        return key
132625
def negotiate_safe(self, name, params):
        
        for param in params.iterkeys():
            if param not in self.defaults:
                return

        try:
            return dict(self.negotiate(name, params))
        except (KeyError, ValueError, AssertionError):
            pass
890317
def send_keycode(keycode)
      send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::DOWN))
      send_request RequestMessage.new(key_event_message: KeyEvent.new(keycode: keycode, action: Action::UP))
    end
162731
def options
      {}.tap{ |options| VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) } }
    end
1307911
def build_info(key, options = {})
      options = DEFAULT_OPTIONS.merge(options)

      note_type = TYPES.fetch(options.fetch(:type, :note).to_s)
      account_name = options.fetch(:account_name, "")
      service_name = options.fetch(:service_name, key)
      label = options.fetch(:label, service_name)

      {
        account_name: account_name,
        service_name: service_name,
        label: label,
        kind: note_type.fetch(:kind),
        type: note_type.fetch(:type),
      }
    end
301091
async def announce(self):
        
        # send a serialized event
        await self.event_broker.send(
            action_type=intialize_service_action(),
            payload=json.dumps(self.summarize())
        )
623669
def toggle(self, key):
        
        val = self[key]
        assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val)
        self.pref_update(key, not val)
1211679
def info_post_request(self, node, info):
        """"""
        for agent in node.neighbors():
            node.transmit(what=info, to_whom=agent)