@register.function
def dev_files_status(files):
 status_count = defaultdict(int)
 choices = File.STATUS_CHOICES
 for file in files:
  status_count[file.status] += 1
 return [(count, unicode(choices[status])) for (status, count) in status_count.items()]

@ register . function def dev_files_status ( files ) : status_count = defaultdict ( int ) choices = File . STATUS_CHOICES for file in files : status_count [ file . status ] += 1 return [ ( count , unicode ( choices [ status ] ) ) for ( status , count ) in status_count . items ( ) ]
group files by their status .