'Generates an executes a query where it matches *a to the
primary keys of the current class\'s table.
The primary key nature can be overridden by providing an
explicit list of columns to search.
This function is only a convenience function, and is called
only by one() and lookup().'

@classmethod
def _lookup(cls, multiple, *a, **kw):

    args = cls._disambiguate_args((lambda x: x.primary_key), *a, **kw)
    res = cls.query().filter(and_(*[(k == v) for (k, v) in args]))
    try:
        res = (res.all() if multiple else res.one())
        if (not res):
            raise NoResultFound
    except NoResultFound:
        raise NotFound, ('%s    with    %s' % (cls.__name__, ','.join((('%s=%s' % x) for x in args))))
    return res
