def load_entity(model, kwarg_old, kwarg_new=None, fetch_mode=None):
    if fetch_mode is None or kwarg_new is None:
        for sufix in ('_key', '_id', '_key_name'):
            if kwarg_old.endswith(sufix):
                if kwarg_new is None:
                    kwarg_new = kwarg_old[:-len(sufix)]

                if fetch_mode is None:
                    fetch_mode = sufix[1:]

                break
        else:
            raise NotImplementedError('Invalid fetch_mode.')

    def decorator(func):
        def decorated(*args, **kwargs):
            entity = None
            key = kwargs.get(kwarg_old, None)
            if key is not None:
                if fetch_mode == 'key':
                    entity = get_or_404(key)
                elif fetch_mode == 'id':
                    entity = get_by_id_or_404(model, key)
                elif fetch_mode == 'key_name':
                    entity = get_by_key_name_or_404(model, key)

            kwargs[kwarg_new] = entity
            return func(*args, **kwargs)

        return decorated

    return decorator
Deletes the temporary folder for processing data
dataset/ETHPy150Open moraes/tipfy/tipfy/appengine/db/__init__.py/load_entity--crossover with--dataset/ETHPy150Open opencolorado/OpenColorado-Tools-and-Utilities/Scripts/ArcGIS/10.0/Python/PublishOpenDataset.py/delete_dataset_temp_folder