def unread_message_count(request):
 count = 0
 if (hasattr(request, 'user') and request.user.is_authenticated()):
  count = unread_count_for(request.user)
 return {'unread_message_count': count}

def unread_message_count ( request ) : count = 0 if ( hasattr ( request , 'user' ) and request . user . is_authenticated ( ) ) : count = unread_count_for ( request . user ) return { 'unread_message_count' : count }
adds the unread private messages count to the context .