Easy null-safe conversion of the raw key.
487013
public static <V> Key<V> key( com.google.appengine.api.datastore.Key raw ) {
        if ( raw == null ) {
            return null;
        } else {
            return new Key<V>( raw );
        }
    }
991065
private void ckeckKey(KeyType keyType) {
		switch (keyType) {
		case PublicKey:
			if (null == this.publicKey) {
				throw new NullPointerException("No public key provided");
			}
			break;
		case PrivateKey:
			if (null == this.privateKey) {
				throw new NullPointerException("No private key provided");
			}
			break;
		}
	}
831852
public static byte[] normalizeKey(byte[] keyData) {
        if (keyData == null) {
            return RSG.generate(16).getBytes(StandardCharsets.UTF_8);
        } else {
            return normalizeKey(new String(keyData, StandardCharsets.UTF_8))
                    .getBytes(StandardCharsets.UTF_8);
        }
    }
480024
public static <K, V> Map<K, V> parse(@Nullable String input, Converter<K> keyConverter, Converter<V> valueConverter) {
    Map<K, V> map = new LinkedHashMap<>();
    if (input != null) {
      FieldParser reader = new FieldParser(input);
      boolean end = false;
      while (!end) {
        String key = reader.nextKey();
        if (key == null) {
          end = true;
        } else {
          String val = StringUtils.defaultString(reader.nextVal(), "");
          map.put(keyConverter.parse(key), valueConverter.parse(val));
        }
      }
    }
    return map;
  }
815615
def _JsonDecodeKey(d):
    """"""
    k_c = d['key_string']
    if isinstance(k_c, (list, tuple)):
        return ndb.Key(flat=k_c)
    return ndb.Key(urlsafe=d['key_string'])
199129
def to_raw(self, value, context=None):
        """"""
        if value is None:
            return None
        res = {}
        value = value.copy()
        errors = []
        for field in list(set(value) & set(self._fields)):
            schema = self._fields.get(field)
            name = schema.get_attr('name', field)
            try:
                res[name] = \
                    schema.to_raw(value.pop(field), context=context)
            except exceptions.ValidationErrors as ex:
                self._update_errors_by_exception(errors, ex, name)

        self._raise_exception_when_errors(errors, value)
        res.update(value)
        return res
955053
private String processKey(String key) {
        AssertUtils.assertNotNull(key, "Key cannot be null");

        String result = null;

        if (this.isCaseSensitive() == false) {
            result = key.toLowerCase(Locale.ENGLISH);
        } else {
            result = key;
        }

        return result;
    }
124686
function raw(obj) {
  const result = {}
  for (const key in obj) {
    const value = obj[key]
    if (value !== null && value !== undefined) {
      result[key] = value.toString()
    }
  }
  return result
}
1011644
def load_key(self, key, key_type, key_encoding):
        
        if key_type is not EncryptionKeyType.SYMMETRIC:
            raise ValueError(
                'Invalid key type "{key_type}" for cipher "{cipher}"'.format(key_type=key_type, cipher=self.java_name)
            )

        if key_encoding is not KeyEncodingType.RAW:
            raise ValueError(
                'Invalid key encoding "{key_encoding}" for cipher "{cipher}"'.format(
                    key_encoding=key_encoding, cipher=self.java_name
                )
            )

        return key
406212
protected String keyToString(Object rawKey)
    {
        if (rawKey instanceof String) {
            return (String) rawKey;
        }
        return String.valueOf(rawKey);
    }
1003652
private static String resolveColumnKey(String key) {
        checkNotNull(key, "The column key must not be null.");
        String lowercaseKey = key.toLowerCase(Locale.ENGLISH);
        String defaultKey = COLUMN_ALIASES.get(lowercaseKey);
        return defaultKey == null ? lowercaseKey : defaultKey;
    }
244380
def get_nulldata(self, rawtx):
        """"""
        tx = deserialize.tx(rawtx)
        index, data = control.get_nulldata(tx)
        return serialize.data(data)
1070816
def _get_key2sl(key):
    """"""
    if isinstance(key, (int, farray)) or key is Ellipsis:
        return key
    elif isinstance(key, slice):
        # Forbid slice steps
        if key.step is not None:
            raise ValueError("farray slice step is not supported")
        return key
    elif isinstance(key, boolfunc.Function):
        return farray([key])
    else:
        raise TypeError("expected int, slice, Function, farray, or ...")
925780
private Class<?> getKey(Class<?> key)
	{
		Class<?> newKey = lookupMap.get(key);
		if (newKey != null)
			return newKey;

		for (Class<?> c : internalMap.keySet())
		{
			if (c.isAssignableFrom(key))
			{
				lookupMap.put(key, c);
				return c;
			}
		}
		return null;
	}
449693
private String makeConverterKey(Class<?> fromClass, String syntax, Class<?> toClass) {
        StringBuilder key = new StringBuilder();
        if (syntax==null) {
            syntax="";
        }
        key.append(fromClass.getName()).append(KEY_SEP).append(syntax).append(KEY_SEP).append(toClass.getName());
        return key.toString();
    }
145329
def to_bytes_or_none(value):
    """"""
    if value == ffi.NULL:
        return None
    elif isinstance(value, ffi.CData):
        return ffi.string(value)
    else:
        raise ValueError('Value must be char[] or NULL')
882722
private static @Nullable SecretKey loadSymmetricKey(Context context, KeyPair wrapperKey) throws NoSuchPaddingException,
	                                                                                                NoSuchAlgorithmException,
	                                                                                                InvalidKeyException {
		String encryptedSymmetricKey = getKeyPrefs(context).getString(PREFS_KEY_SYMMETRIC_KEY, null);
		if (StringUtils.isNullOrEmpty(encryptedSymmetricKey)) {
			return null;
		}

		return unwrapSymmetricKey(wrapperKey, encryptedSymmetricKey);
	}