code: def _create_annotation(
      api,
      task_id,
      shape=None,
      tag=None,
      track=None,
      points=None,
      _type=None,
      _label=None,
      group_id=0,
  ):
      if points is None:
          points = [10, 20, 30, 40]
      if _type is None:
          _type = "rectangle"
      shapes = []
      tags = []
      tracks = []
      if shape is not None:
          if not isinstance(shape, dict):
              if _label is None:
                  label = _get_label(api, task_id, label=shape)
              else:
                  label = _get_label(api, task_id, label=_label)
  
              shape = {
                  "type": _type,
                  "frame": 0,
                  "label_id": label,
                  "group": group_id,
                  "attributes": [],
                  "points": points,
                  "occluded": False,
              }
          shapes = [shape]
  
      if tag is not None:
          if not isinstance(tag, dict):
              if _label is None:
                  label = _get_label(api, task_id, label=tag)
              else:
                  label = _get_label(api, task_id, label=_label)
              tag = {
                  "frame": 0,
                  "label_id": label,
                  "group": group_id,
                  "attributes": [],
              }
          tags = [tag]
  
      if track is not None:
          if not isinstance(track, dict):
              if _label is None:
                  label = _get_label(api, task_id, label=track)
              else:
                  label = _get_label(api, task_id, label=_label)
              if isinstance(track, tuple):
                  start, end = track
              else:
                  start, end = 0, -1
              track = {
                  "frame": start,
                  "label_id": label,
                  "group": group_id,
                  "shapes": [
                      {
                          "type": _type,
                          "occluded": False,
                          "points": points,
                          "frame": start,
                          "outside": False,
                          "attributes": [],
                          "z_order": 0,
                      }
                  ],
                  "attributes": [],
              }
              if end > start:
                  track["shapes"].append(
                      {
                          "type": _type,
                          "occluded": False,
                          "points": points,
                          "frame": end,
                          "outside": True,
                          "attributes": [],
                          "z_order": 0,
                      }
                  )
              tracks.append(track)
  
      create_json = {
          "version": 1,
          "tags": tags,
          "shapes": shapes,
          "tracks": tracks,
      }
      create_url = api.task_annotation_url(task_id) + "?action=create"
      api.patch(create_url, json=create_json)
  
imports: from bson import ObjectId
  from collections import defaultdict
  import numpy
  import os
  import unittest
  import eta.core.utils
  import fiftyone
  import fiftyone.utils.cvat
  import fiftyone.zoo
  from fiftyone.core.expressions import ViewField
label_desc: Use image node_id 6 for calling a global function with example usage: _create_annotation(api, task_id, shape, tag, track, points, _type, _label, group_id) without return types