def get_members_from_bulk(bulk_data, **additional_fields):
 members = []
 for data in bulk_data:
  data_copy = data.copy()
  username = data_copy.pop('username')
  try:
   validate_email(username)
   data_copy['email'] = username
  except ValidationError:
   user = User.objects.filter(username=username).first()
   data_copy['user_id'] = user.id
  data_copy.update(additional_fields)
  members.append(models.Membership(**data_copy))
 return members

def get_members_from_bulk ( bulk_data , ** additional_fields ) : members = [ ] for data in bulk_data : data_copy = data . copy ( ) username = data_copy . pop ( 'username' ) try : validate_email ( username ) data_copy [ 'email' ] = username except ValidationError : user = User . objects . filter ( username = username ) . first ( ) data_copy [ 'user_id' ] = user . id data_copy . update ( additional_fields ) members . append ( models . Membership ( ** data_copy ) ) return members
convert bulk_data into a list of members .