returns the necessary string value for an HKEY for the win32security module
545004
def getSecurityHkey(self, s):
        '''
        
        '''
        try:
            return self.hkeys_security[s]
        except KeyError:
            raise CommandExecutionError((
                'No HKEY named "{0}".  It should be one of the following:  {1}'
                ).format(s, ', '.join(self.hkeys_security)))
434349
public String getSecurityErrorText(int iErrorCode)
    {
        String key = "Error " + Integer.toString(iErrorCode);
        if (iErrorCode == Constants.ACCESS_DENIED)
            key = "Access Denied";
        if (iErrorCode == Constants.LOGIN_REQUIRED)
            key = "Login required";
        if (iErrorCode == Constants.AUTHENTICATION_REQUIRED)
            key = "Authentication required";
        if (iErrorCode == Constants.CREATE_USER_REQUIRED)
            key = "Create user required";
        key = this.getResources(ThinResourceConstants.ERROR_RESOURCE, true).getString(key);
        return key;
    }
1208356
def hkeys(self, name):
        
        with self.pipe as pipe:
            f = Future()
            res = pipe.hkeys(self.redis_key(name))

            def cb():
                m_decode = self.memberparse.decode
                f.set([m_decode(v) for v in res.result])

            pipe.on_execute(cb)
            return f
1256232
def _get_instance_key(self, host, namespace, wmi_class, other=None):
        
        if other:
            return "{host}:{namespace}:{wmi_class}-{other}".format(
                host=host, namespace=namespace, wmi_class=wmi_class, other=other
            )

        return "{host}:{namespace}:{wmi_class}".format(host=host, namespace=namespace, wmi_class=wmi_class)
814096
def codes_get_string_array(handle, key, size, length=None):
    # type: (cffi.FFI.CData, bytes, int, int) -> T.List[bytes]
    
    if length is None:
        length = codes_get_string_length(handle, key)
    values_keepalive = [ffi.new('char[]', length) for _ in range(size)]
    values = ffi.new('char*[]', values_keepalive)
    size_p = ffi.new('size_t *', size)
    _codes_get_string_array(handle, key.encode(ENC), values, size_p)
    return [ffi.string(values[i]).decode(ENC) for i in range(size_p[0])]
1224647
def get_sid_from_name(name):
    '''
    
    '''
    # If None is passed, use the Universal Well-known SID "Null SID"
    if name is None:
        name = 'NULL SID'

    try:
        sid = win32security.LookupAccountName(None, name)[0]
    except pywintypes.error as exc:
        raise CommandExecutionError(
            'User {0} not found: {1}'.format(name, exc))

    return win32security.ConvertSidToStringSid(sid)
519736
def get_version_info_str(self, key_name='ver_sw_release'):
        
        version = self.get_version_info(key_name)
        if not version is None and version[3] >= 64:
            type_str = ''
            if version[3] < 128: type_str = ' (alpha)'
            elif version[3] < 192: type_str = ' (beta)'
            elif version[3] < 255: type_str = ' (RC)'
            return 'v{}.{}.{}{}'.format(version[0], version[1], version[2], type_str)
        return None
603800
def get_string(self, key):
        """"""

        # Massive hack, lol
        if key.startswith("lambda."):
            key = "lambda.items.{0}".format(key[7:])
        if key.startswith("apigateway."):
            key = "apigateway.items.{0}".format(key[11:])

        # Make sure key is in all_options
        if key not in self.all_options:
            kwargs = {}
            if len(self.chain) > 1:
                kwargs['source'] = Meta(self.all_options, self.chain[-2]).source
            raise BadOptionFormat("Can't find key in options", key=key, chain=self.chain, **kwargs)

        return super(MergedOptionStringFormatter, self).get_string(key)
1131343
def safe_str(value):
    
    if sys.version_info < (3,0) and isinstance(value, unicode):
        return value.encode('utf-8')
    else:
        return str(value)
481928
function getCharacteristicFormatsKey(format) {
  // coerce 'int32' to 'int'
  if (format == 'int32') format = 'int';

  // look up the key in our known-formats dict
  for (var key in Characteristic.Formats)
    if (Characteristic.Formats[key] == format)
      return key;

  throw new Error("Unknown characteristic format '" + format + "'");
}
518767
def GetValueByName(self, name):
    
    if not self._registry_key and self._registry:
      self._GetKeyFromRegistry()

    if not self._registry_key:
      return None

    return self._registry_key.GetValueByName(name)
162232
function getKeyPath(aKeys) {
							var vKey;

							if (aKeys && aKeys.length === 1) {
								vKey = aKeys[0];
							} else {
								throw new Error("Single key expected: " + sTypePath);
							}

							return typeof vKey === "string" ? vKey : vKey[Object.keys(vKey)[0]];
						}
1114433
def _get_key_value(string):
    """"""
    # Normally all properties look like this:
    #   Unique Identifier: 600508B1001CE4ACF473EE9C826230FF
    #   Disk Name: /dev/sda
    #   Mount Points: None
    key = ''
    value = ''
    try:
        key, value = string.split(': ')
    except ValueError:
        # This handles the case when the property of a logical drive
        # returned is as follows. Here we cannot split by ':' because
        # the disk id has colon in it. So if this is about disk,
        # then strip it accordingly.
        #   Mirror Group 0: physicaldrive 6I:1:5
        string = string.lstrip(' ')
        if string.startswith('physicaldrive'):
            fields = string.split(' ')
            # Include fields[1] to key to avoid duplicate pairs
            # with the same 'physicaldrive' key
            key = fields[0] + " " + fields[1]
            value = fields[1]
        else:
            # TODO(rameshg87): Check if this ever occurs.
            return string.strip(' '), None

    return key.strip(' '), value.strip(' ')
1157441
def get_extended_key(self):
        
        network_hex_chars = hexlify(
            chr_py2(self.network.SECRET_KEY))
        return ensure_bytes(network_hex_chars + self.get_key())
628142
def _get_random_string(length=44,
                       allowed_chars='abcdefghijklmnopqrstuvwxyz'
                       'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
                       secret_key=settings.secret_key_bytes()):
    
    secret_key = _ensure_bytes(secret_key)
    _reseed_if_needed(using_sysrandom, secret_key)
    return ''.join(random.choice(allowed_chars) for i in range(length))
897544
def _get_from_registry(self):
        
        from ._windows import reg_keys
        for location in reg_keys:
            location = location.replace('\\', '/')
            jreKey = "/proc/registry/HKEY_LOCAL_MACHINE/{}".format(location)
            try:
                with open(jreKey + "/CurrentVersion") as f:
                    cv = f.read().split('\x00')
                versionKey = jreKey + "/" + cv[0]

                with open(versionKey + "/RunTimeLib") as f:
                    cv = f.read().split('\x00')

                return cv[0]

            except OSError:
                pass
        return None
464931
def get_subkey(self,name):
        
        subkey = Key(name,self)
        try:
            hkey = subkey.hkey
        except WindowsError:
            raise AttributeError("subkey '%s' does not exist" % (name,))
        return subkey