'Selection by field values
db(key=value) returns the list of records where r[key] = value'

def __call__(self, *args, **kw):

    if (args and kw):
        raise SyntaxError("Can't    specify    positional    AND    keyword    arguments")
    if args:
        if (len(args) > 1):
            raise SyntaxError('Only    one    field    can    be    specified')
        elif (args[0] not in self.fields):
            raise ValueError(('%s    is    not    a    field' % args[0]))
        else:
            return Tester(self, args[0])
    if (not kw):
        return self.records.values()
    keys = kw.keys()
    ixs = (set(keys) & set(self.indices.keys()))
    no_ix = (set(keys) - ixs)
    if ixs:
        ix = ixs.pop()
        res = set(self.indices[ix].get(kw[ix], []))
        if (not res):
            return []
        while ixs:
            ix = ixs.pop()
            res = (res & set(self.indices[ix].get(kw[ix], [])))
    else:
        field = no_ix.pop()
        res = set([r['__id__'] for r in self if (r[field] == kw[field])])
    for field in no_ix:
        res = (res & set([_id for _id in res if (self.records[_id][field] == kw[field])]))
    return [self[_id] for _id in res]
