'Return an iterator that\'s filtered by which flags are set on a key.'

def filter(self, flag=None):

    if (flag is None):
        return self.all()
    if (flag is DEFAULT_FLAGS):
        return (k for k in self.all() if (k.flags is DEFAULT_FLAGS))
    return (k for k in self.all() if (k.flags & flag))
