def sort_entries(is_all, cache, entries):
    """sort entries before sending"""
    totweet = []
    if not is_all:
        for i in entries:
            if 'id' in i:
                if i['id'] not in cache.getdeque():
                    totweet.append(i)
            elif 'guid' in i:
                if i['guid'] not in cache.getdeque():
                    totweet.append(i)
            elif i['link'] not in cache.getdeque():
                totweet.append(i)
    else:
        totweet = entries
    return totweet
