def _create_annotation(api, task_id, shape=None, tag=None, track=None, points=None, _type=None):
    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)):
            label = _get_label(api, task_id, label=shape)
            shape = {'type': _type, 'frame': 0, 'label_id': label, 'group': 0, 'attributes': [], 'points': points, 'occluded': False}
        shapes = [shape]
    if (tag is not None):
        if (not isinstance(tag, dict)):
            label = _get_label(api, task_id, label=tag)
            tag = {'frame': 0, 'label_id': label, 'group': 0, 'attributes': []}
        tags = [tag]
    if (track is not None):
        if (not isinstance(track, dict)):
            label = _get_label(api, task_id, label=track)
            if isinstance(track, tuple):
                (start, end) = track
            else:
                (start, end) = (0, (- 1))
            track = {'frame': start, 'label_id': label, 'group': 0, '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)
def _create_annotation(api, task_id, shape=None, tag=None, track=None, points=None, _type=None):
    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)):
            label = _get_label(api, task_id, label=shape)
            shape = {'type': _type, 'frame': 0, 'label_id': label, 'group': 0, 'attributes': [], 'points': points, 'occluded': False}
        shapes = [shape]
    if (tag is not None):
        if (not isinstance(tag, dict)):
            label = _get_label(api, task_id, label=tag)
            tag = {'frame': 0, 'label_id': label, 'group': 0, 'attributes': []}
        tags = [tag]
    if (track is not None):
        if (not isinstance(track, dict)):
            label = _get_label(api, task_id, label=track)
            if isinstance(track, tuple):
                (start, end) = track
            else:
                (start, end) = (0, (- 1))
            track = {'frame': start, 'label_id': label, 'group': 0, '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)