Generate a new device id or return existing device id for key

        :param key: Key for device
        :type key: unicode
        :return: The device id
        :rtype: int
427027
def _new_device_id(self, key):
        
        device_id = Id.SERVER + 1
        if key in self._key2deviceId:
            return self._key2deviceId[key]
        while device_id in self._clients:
            device_id += 1
        return device_id
11638
def key_exists(self, key):
        
        assert isinstance(key, str)
        self._close()
        try:
            return self._unsafe_key_exists(key)
        finally:
            self._open()
1113490
def get(self, key):
        
        try:
            return self[self.id_lookup.get(key)]

        except TypeError:
            raise KeyError
34366
def get(self, key: str) -> Optional[str]:
        
        return get_config(self.full_key(key))
371642
def get_index(self, key):
        
        try:
            return self[self.index_lookup.get(key)]

        except TypeError:
            raise KeyError
55532
def add(self, key):
        
        if key not in self.map:
            self.map[key] = len(self.items)
            self.items.append(key)
        return self.map[key]
1129466
def _encode_key(self, key):
        
        if isinstance(key, str) or isinstance(key, unicode):
            key = key.encode(self._keyencoding)
        elif not isinstance(key, bytes):
            raise TypeError("key must be bytes or str")
        return codecs.encode(key, 'hex_codec').decode(self._keyencoding)
1274622
def key_dict( from_dict ):
	
	new_dict = {}
	old2new = {}
	new2old = {}
	for key in from_dict:
		k = normalizeUnicode(key,'identifier')
		if k != key:
			i = ''
			while new_dict.has_key("%s%s" % (k,i) ):
				if not i:
					i = 1
				else:
					i += 1
			k = "%s%s" % (k,i)
			old2new[key] = k
			new2old[k] = key
		new_dict[k] = from_dict[key]
	return (new_dict.keys(), new_dict, old2new, new2old)
706238
def gen_unique_id():
    
    # Workaround for http://bugs.python.org/issue4607
    if ctypes and _uuid_generate_random:
        buffer = ctypes.create_string_buffer(16)
        _uuid_generate_random(buffer)
        return str(UUID(bytes=buffer.raw))
    return str(uuid4())
1372868
def key(self, key, strictkey=None):
        
        return self._select(self._pointer.key(key, strictkey))
1096510
def storeIDToWebID(key, storeid):
    
    i = key ^ storeid
    l = list('%0.16x' % (i,))
    for nybbleid in range(0, 8):
        a, b = _swapat(key, nybbleid)
        _swap(l, a, b)
    return ''.join(l)
33247
def get_next_id_for(self, key):
        
        portal_type = key.split("-")[0]
        config = get_config(None, portal_type=portal_type)
        id_template = config.get("form", "")
        number = self.storage.get(key) + 1
        spec = {
            "seq": number,
            "alpha": Alphanumber(number),
            "year": get_current_year(),
            "parent_analysisrequest": "ParentAR",
            "parent_ar_id": "ParentARId",
            "sampleType": key.replace(portal_type, "").strip("-"),
        }
        return id_template.format(**spec)
1195786
def get(self, key, default=None):
        
        if not isinstance(key, bytes):
            key = key.encode('utf8')

        return self.b_get_value(key) or default
171632
def getDevice(self, id):
        
        return next(iter([d for d in self.devices.values() if d.deviceId == id]), None)
333501
def Get(self,key):
		

		for disk in self.disks:
			if disk.id == key:  return(disk)
			elif key in disk.partition_paths:  return(disk)
1069852
def get_value(self, key):
        # type: (str) -> Any
        
        try:
            return self._dictionary[key]
        except KeyError:
            raise ConfigurationError("No such key - {}".format(key))
1013758
def key_by(self, key_selector):
        
        op = Operator(
            _generate_uuid(),
            OpType.KeyBy,
            "KeyBy",
            other=key_selector,
            num_instances=self.env.config.parallelism)
        return self.__register(op)