@staticmethod
    def survey_formatter_duplicate(item):

        data = item.data
        tid = data.get("template_id")
        sid = data.get("section_id")
        table = item.table
        query = (table.template_id == tid) & \
                (table.section_id == sid)
        duplicate = current.db(query).select(table.id,
                                             limitby=(0, 1)).first()
        if duplicate:
            item.id = duplicate.id
            item.method = item.METHOD.UPDATE

# =============================================================================
Rules for finding a duplicate:
dataset/ETHPy150Open sahana/eden/modules/s3db/survey.py/S3SurveyFormatterModel.survey_formatter_duplicate