def get_enrollment(classroom, enrolled_only=False):
  """Gets the list of students that have enrolled.

  Args:
    classroom: The classroom whose enrollment to get.
    enrolled_only: If True, only return the set that are enrolled. Default is
        False.
  Returns:
    Set of Enrollment entries for the classroom.
  """
  if enrolled_only:
    query = classroom.enrollment_set.filter('is_enrolled =', True)
  else:
    query = classroom.enrollment_set
  return query.fetch(classroom.max_enrollment)