'Import item de-duplication'

@staticmethod
def org_sector_duplicate(item):

    data = item.data
    abrv = data.get('abrv')
    name = data.get('name')
    table = item.table
    if abrv:
        query = (table.abrv.lower() == s3_unicode(abrv).lower())
    elif name:
        query = (table.name.lower() == s3_unicode(name).lower())
    else:
        return
    duplicate = current.db(query).select(table.id, table.name, limitby=(0, 1)).first()
    if duplicate:
        if (not name):
            data['name'] = duplicate.name
        item.id = duplicate.id
        item.method = item.METHOD.UPDATE
    elif (not name):
        error = ('Invalid    sector:    %s' % abrv)
        item.accepted = False
        item.error = error
        if (item.element is not None):
            item.element.set(current.xml.ATTRIBUTE['error'], error)
