'Returns objects whose attributes match the given kwargs.'

def filter(self, filtered=None, **kwargs):

    if (filtered is None):
        filtered = self._objects
    try:
        (key, value) = kwargs.popitem()
    except KeyError:
        return filtered
    def get_match(obj):
        return (hasattr(obj, key) and (getattr(obj, key) == value))
    filtered = [obj for obj in filtered if get_match(obj)]
    return self.filter(filtered=filtered, **kwargs)
