'Find all entity keys with ids in their paths.
Args:
record_generator: A generator of entity_encoding strings.
Returns:
A list of keys to reserve.'

def _find_keys_to_reserve(self, record_generator):

    keys_to_reserve = []
    for values in record_generator:
        entity = self.create_entity(values)
        key = entity.key()
        for id_or_name in key.to_path()[1::2]:
            if isinstance(id_or_name, (int, long)):
                keys_to_reserve.append(key)
                break
    return keys_to_reserve
