(requests, case_trigger_info, case_config)
return get_tracked_entity_instance_and_etag_by_id(
        requests, tei_id, case_trigger_info
    )
Returns a tracked entity that corresponds to case_trigger_info and
    its ETag, or (None, None) if a corresponding Tracked Entity was not
    found.

    Raises BadTrackedEntityInstanceID if a Tracked Entity ID believed to
    have been issued by the DHIS2 server is not found on that server.

    Raises MultipleInstancesFound if unable to select a
    corresponding Tracked Entity from multiple available candidates.
Returns a tracked entity that corresponds to case_trigger_info and
    its ETag, or (None, None) if a corresponding Tracked Entity was not
    found.
Returns a tracked entity that corresponds to case_trigger_info and its ETag or ( None None ) if a corresponding Tracked Entity was not found .
def get_tracked_entity_and_etag(requests, case_trigger_info, case_config):
    """
    Returns a tracked entity that corresponds to case_trigger_info and
    its ETag, or (None, None) if a corresponding Tracked Entity was not
    found.

    Raises BadTrackedEntityInstanceID if a Tracked Entity ID believed to
    have been issued by the DHIS2 server is not found on that server.

    Raises MultipleInstancesFound if unable to select a
    corresponding Tracked Entity from multiple available candidates.
    """
    tei_id = get_tracked_entity_instance_id(case_trigger_info, case_config)
    if not tei_id:
        tracked_entities = find_tracked_entity_instances(
            requests, case_trigger_info, case_config
        )
        if not tracked_entities:
            return (None, None)
        if len(tracked_entities) > 1:
            raise MultipleInstancesFound(_(
                '{n} tracked entity instances were found for case {case}'
            ).format(n=len(tracked_entities), case=case_trigger_info))
        tei_id = tracked_entities[0]["trackedEntityInstance"]
    return get_tracked_entity_instance_and_etag_by_id(
        requests, tei_id, case_trigger_info
    )
def get_tracked_entity_and_etag ( requests , case_trigger_info , case_config ) : tei_id = get_tracked_entity_instance_id ( case_trigger_info , case_config ) if not tei_id : tracked_entities = find_tracked_entity_instances ( requests , case_trigger_info , case_config ) if not tracked_entities : return ( None , None ) if len ( tracked_entities ) > 1 : raise MultipleInstancesFound ( _ ( '{n} tracked entity instances were found for case {case}' ) . format ( n = len ( tracked_entities ) , case = case_trigger_info ) ) tei_id = tracked_entities [ 0 ] [ "trackedEntityInstance" ] return get_tracked_entity_instance_and_etag_by_id ( requests , tei_id , case_trigger_info )