'Entry point for importer
@param item: the import item
@return: the duplicate Row if match found, otherwise None
@raise SyntaxError: if any of the query fields doesn\'t exist
in the item table'

def __call__(self, item):

    data = item.data
    table = item.table
    query = None
    error = 'Invalid    field    for    duplicate    detection:    %s    (%s)'
    match = self.match
    primary = self.primary
    for fname in primary:
        if (fname not in table.fields):
            raise SyntaxError((error % (fname, table)))
        field = table[fname]
        value = data.get(fname)
        q = self.match(field, value)
        query = (q if (query is None) else (query & q))
    secondary = self.secondary
    for fname in secondary:
        if (fname not in table.fields):
            raise SyntaxError((error % (fname, table)))
        field = table[fname]
        value = data.get(fname)
        if value:
            query &= self.match(field, value)
    if (self.ignore_deleted and ('deleted' in table.fields)):
        query &= (table.deleted != True)
    duplicate = current.db(query).select(table._id, limitby=(0, 1)).first()
    if duplicate:
        item.id = duplicate[table._id]
        if (not data.deleted):
            item.method = item.METHOD.UPDATE
    return duplicate
