def _get_sections_by_person_and_term(person,
                                     term,
                                     course_role,
                                     include_secondaries,
                                     future_terms,
                                     transcriptable_course,
                                     delete_flag):
    """
    Returns the response data for a search request containing the
    passed course_role and term (including secondaries).
    @param: future_terms: 0..400
    @param: transcriptable_course: 'yes', 'no', 'all'
    @param: delete_flag: ['active', 'suspended', 'withdrawn']
    """
    params = [
        ("reg_id", person.uwregid,),
        ("search_by", course_role,),
        ("quarter", term.quarter.lower(),),
        ("include_secondaries", 'on' if include_secondaries else ''),
        ("year", term.year,),
        ("future_terms", future_terms,),
        ("transcriptable_course", transcriptable_course,),
    ]

    if delete_flag is not None:
        if not isinstance(delete_flag, list):
            raise ValueError("delete_flag must be a list")
        params.append(("delete_flag", ','.join(sorted(delete_flag)),))

    url = "{}?{}".format(section_res_url_prefix, urlencode(params))
    return get_resource(url)