docs: def exec_task(task_path, data):
      """Execute task.
  
      :param task_path: task path
      :type task_path: str|Callable
      :param data: task's data
      :type data: Any
      :return:
      """
      if not data:
          data = {'data': None, 'path': task_path}
  
      elif not isinstance(data, (str, bytes)):
          data = {'data': json.dumps(data, cls=RequestJSONEncoder),
                  'path': task_path}
  
      else:
          # Open the data from file, if necessary.
          if data is not None and data.startswith("file://"):
              with open(data[len("file://"):]) as f:
                  data = f.read()
  
          data = {'data': data, 'path': task_path}
  
      # Prepare the task.
      job = Job(data)
      (task, task_callable) = create_task(task_path)
  
      with delegating_job_context(job, task, task_callable) as jc:
          return jc.task_callable(jc.task_data)