code: public static Key marshalKey(DefaultEntityManager entityManager, Object entity) {
      Marshaller marshaller = new Marshaller(entityManager, entity, Intent.DELETE);
      marshaller.marshalKey();
      return (Key) marshaller.key;
    }
docs: Extracts the key from the given object, entity, and returns it. The entity must have its ID
  set.
  
  @param entityManager
  the entity manager.
  @param entity
  the entity from which key is to be extracted
  @return extracted key.