def submit_case_update_form(casedoc, update_dict, couch_user, submit_date=None, xmlns=XMLNS_PATIENT_UPDATE, sync_token=None):
    """
    Main entry point for submitting an update for a pact patient

    Args:
    casedoc: the patient case
    update_dict: the kv of the fields being changed
    couch_user: user committing the change
    submit_date: now if None
    """

    if submit_date is None:
        submit_date = datetime.utcnow()
    form = etree.Element("data", nsmap={None: xmlns, 'jrm': "http://dev.commcarehq.org/jr/xforms"})
    meta_block = generate_meta_block(couch_user, timestart=submit_date, timeend=submit_date)
    form.append(meta_block)

    update_block = prepare_case_update_xml_block(casedoc, couch_user, update_dict, submit_date)
    form.append(update_block)
    # todo: this date is based off midnight UTC not local time...
    encounter_date = etree.XML(json_format_date(datetime.utcnow()) % '<encounter_date>%s</encounter_date>')
    form.append(encounter_date)

    submission_xml_string = etree.tostring(form)
    if sync_token:
        extra_meta = {LAST_SYNCTOKEN_HEADER: sync_token}
    else:
        extra_meta = None
    return submit_xform('/a/pact/receiver', PACT_DOMAIN, submission_xml_string, extra_meta=extra_meta)
dataset/ETHPy150Open dimagi/commcare-hq/custom/_legacy/pact/api.py/submit_case_update_form/swapped operands of `%`