convert the given key to a string that would be appropriate for lexical sorting, e.g. within a database, where the sorting is the same given by the collate() function.
776279
function toIndexableString(key) {
  var zero = '\u0000';
  key = normalizeKey(key);
  return collationIndex(key) + SEP + indexify(key) + zero;
}
1245056
def _fix_key(key):
        ''''''
        if isinstance(key, unicode):
            return key
        if isinstance(key, str):
            # On my system, the default encoding is `ascii`, so let's
            # explicitly say UTF-8?
            return unicode(key, 'utf-8')
        raise TypeError(key)
1091354
def _normalize_keys(self, data):
        
        encode = self.encoder.encode
        decode = self.encoder.decode
        return {decode(encode(k)): v for k, v in iteritems(data)}
165428
def format_key(key)
      key = key.to_s
      key = key.gsub('PayPal', 'Paypal')
      key = key.gsub('eBay',   'Ebay')
      key = key.gsub('EBay',   'Ebay')
      key.underscore.to_sym
    end
1085211
def _parse_key(key):
    '''
    
    '''
    splt = key.split("\\")
    hive = splt.pop(0)
    key = '\\'.join(splt)
    return hive, key
1305560
def translate_key_val(val, delimiter='='):
    '''
    
    '''
    if isinstance(val, dict):
        return val
    val = translate_stringlist(val)
    new_val = {}
    for item in val:
        try:
            lvalue, rvalue = split(item, delimiter, 1)
        except (AttributeError, TypeError, ValueError):
            raise SaltInvocationError(
                '\'{0}\' is not a key{1}value pair'.format(item, delimiter)
            )
        new_val[lvalue] = rvalue
    return new_val
1070892
def normalize_string_keys(old):
    """"""
    new = {}
    for key, value in old.items():
        if isinstance(key, bytes_):
            new[key.decode('utf8')] = value
        else:
            new[key] = value
    return new
1317143
def _to_dot_key(cls, section, key=None):
        
        if key:
            return (NON_ALPHA_NUM.sub('_', section.lower()), NON_ALPHA_NUM.sub('_', key.lower()))
        else:
            return NON_ALPHA_NUM.sub('_', section.lower())
861746
static String mapEntryToString(Object key, Object val) {
        final String k, v;
        final int klen, vlen;
        final char[] chars =
            new char[(klen = (k = objectToString(key)).length()) +
                     (vlen = (v = objectToString(val)).length()) + 1];
        k.getChars(0, klen, chars, 0);
        chars[klen] = '=';
        v.getChars(0, vlen, chars, klen + 1);
        return new String(chars);
    }
371266
def keys_to_values(self, keys):
        ""
        return dict((k, v) for k, v in self.data.items() if k in keys)
687344
def get_kkf(ekey):
    
    key, fmt = ekey
    if '/' in key:
        key, kind = key.split('/', 1)
    else:
        kind = ''
    return key, kind, fmt
251172
def keys(self, pattern, *, encoding=_NOTSET):
        """"""
        return self.execute(b'KEYS', pattern, encoding=encoding)
91213
def composeWord(key, value):
    
    mapping = {True: 'yes', False: 'no'}
    # this is necesary because 1 == True, 0 == False
    if type(value) == int:
        value = str(value)
    else:
        value = mapping.get(value, str(value))
    return '={}={}'.format(key, value)
716183
private static function stringifyArrayKey(array $key): string
    {
        ksort($key);

        foreach ($key as &$value) {
            if (is_array($value)) {
                $value = self::stringifyArrayKey($value);
            } elseif (is_object($value)) {
                $value = self::stringifyKey($value);
            }
        }

        return json_encode($key);
    }
83531
private static function arrayKeyString(array $key): string
    {
        ksort($key);
        foreach ($key as &$value) {
            if (is_array($value)) {
                $value = self::arrayKeyString($value);
            } elseif (is_object($value)) {
                $value = self::keyString($value);
            }
        }

        return json_encode($key);
    }
475657
private static function stringifyKey($key): string
    {
        if ($key === null || is_scalar($key)) {
            return (string) $key;
        }

        if (is_object($key)) {
            return spl_object_hash($key);
        }

        return static::stringifyArrayKey($key);
    }
289216
function formatKey(key) {
  key = key.toLowerCase()
  // Don't capitalize -ms- prefix
  if (/^-ms-/.test(key)) key = key.substr(1)
  return t.identifier(hyphenToCamelCase(key))
}