def get_student_data(students, exclude=None):
 FakeUser = namedtuple('Fake', 'id username is_anonymous')
 exclude = (exclude if exclude else set())
 def make(svalue):
  "\n        Given a User value entry `svalue`, extracts the student's email and fullname,\n        and provides a unique id for the user.\n\n        Returns a dictionary with keys 'EMAIL', 'FULLNAME', and 'EDX_ID'.\n        "
  fake_user = FakeUser(svalue['user_id'], svalue['user__username'], (lambda : True))
  entry = {'EMAIL': svalue['user__email'], 'FULLNAME': svalue['name'].title(), 'EDX_ID': unique_id_for_user(fake_user)}
  return entry
 fields = ('user__email', 'name', 'user_id', 'user__username')
 values = students.values(*fields)
 exclude_func = (lambda s: (s['user__email'] in exclude))
 return [make(s) for s in values if (not exclude_func(s))]

def get_student_data ( students , exclude = None ) : FakeUser = namedtuple ( 'Fake' , 'id username is_anonymous' ) exclude = ( exclude if exclude else set ( ) ) def make ( svalue ) : fake_user = FakeUser ( svalue [ 'user_id' ] , svalue [ 'user__username' ] , ( lambda : True ) ) entry = { 'EMAIL' : svalue [ 'user__email' ] , 'FULLNAME' : svalue [ 'name' ] . title ( ) , 'EDX_ID' : unique_id_for_user ( fake_user ) } return entry fields = ( 'user__email' , 'name' , 'user_id' , 'user__username' ) values = students . values ( * fields ) exclude_func = ( lambda s : ( s [ 'user__email' ] in exclude ) ) return [ make ( s ) for s in values if ( not exclude_func ( s ) ) ]
given a queryset of django users .