Returns a list of gradebook participants for the passed gradebook_id and
    person.

def get_participants_for_gradebook(gradebook_id, person=None):
    """
    Returns a list of gradebook participants for the passed gradebook_id and
    person.
    """
    if not valid_gradebook_id(gradebook_id):
        raise InvalidGradebookID(gradebook_id)

    url = "/rest/gradebook/v1/book/{}/participants".format(gradebook_id)
    headers = {}

    if person is not None:
        headers["X-UW-Act-as"] = person.uwnetid

    data = get_resource(url, headers)

    participants = []
    for pt in data["participants"]:
        participants.append(_participant_from_json(pt))

    return participants