def METHOD_NAME(self, row=None):
    carrier_id = row.get('tracking_carrier')
    tracking_number = row.get('tracking_number')
    errors = []
    if len(tracking_number or '') == 0:
        errors.append(exceptions.APIException(
            f"A tracking number is required.",
            code="tracking_number_required",
        ))
    if carrier_id is None:
        errors.append(exceptions.APIException(
            f"No carrier connection found.",
            code="invalid_carrier",
        ))
    if any(errors):
        raise exceptions.APIExceptions(
            errors, code="invalid_row",
        )
    tracker = (
        manager.Tracking.access_by(context)
        .filter(tracking_number=tracking_number)
        .first()
    )
    carrier = providers.Carrier.objects.get(id=carrier_id).settings
    exists = getattr(tracker, "carrier_name", None) == carrier.carrier_name
    meta = ({} if batch_id is None else dict(meta=dict(batch_id=batch_id)))
    instance = tracker if exists else manager.Tracking(
        status="unknown",
        test_mode=context.test_mode,
        created_by_id=context.user.id,
        tracking_number=tracking_number,
        events=utils.default_tracking_event(
            description="Awaiting update from carrier...",
            code="UNKNOWN",
        ),
        **meta,
    )
    return instance