'Warning: very slow, dangerous to apply on unfiltered querysets.'

def with_perms(self, profile, thread=None):

    qs = self.all()
    if thread:
        qs = self.filter(thread=thread)
    ids = [note.id for note in qs if user_has_perm_note(note, profile)]
    return self.filter(id__in=ids)
