code: def get_result(item, preset, user=None, wait=True):
      # Get or create Result with preset and item
      result, created = Result.get_first_or_create(
          preset=preset, item=item
      )
  
      if (
          created
          or not settings.CACHE_RESULT
          or (not result.has_file() and not result.has_hdf5())
      ):
          if user.is_authenticated:
              task, c = Task.get_first_or_create(
                  experience=preset.get_single_experience(),
                  item=item,
                  test=item.test,
                  author=user,
              )
          else:
              task, c = Task.get_first_or_create(
                  experience=preset.get_single_experience(),
                  item=item,
                  test=item.test,
              )
  
          task.save()
          task.run(wait=wait)
  
          # SMELLS: might not get the last good result
          # TODO: manage Task running return for Analysis through API
          result, created = Result.get_first_or_create(
              preset=preset, item=item
          )
  
          return result
  
      else:
          return result
  
file_path: TimeSide/timeside/server/utils.py
imports: import os
  import timeside.core
  import json
  from django.conf import settings
  from timeside.core.api import IEncoder
  from timeside.server.models import Processor, Preset, Result, Task
  from rest_framework.views import exception_handler
  from rest_framework.renderers import BaseRenderer, JSONRenderer
label_desc: Use image node_id 2 for calling a global function with example usage: get_result(item, preset, user, wait) and returns: result, result