'Delete a team. Passes `kwargs` to `confirm_prompt`.
Expects edx.team.deleted event to be emitted, with correct course_id.
Also expects edx.team.learner_removed event to be emitted for the
membership that is removed as a part of the delete operation.'

def delete_team(self, **kwargs):

    self.team_page.click_edit_team_button()
    self.team_management_page.wait_for_page()
    self.team_management_page.delete_team_button.click()
    if (('cancel' in kwargs) and (kwargs['cancel'] is True)):
        confirm_prompt(self.team_management_page, **kwargs)
    else:
        expected_events = [{'event_type': 'edx.team.deleted', 'event': {'team_id': self.team['id']}}, {'event_type': 'edx.team.learner_removed', 'event': {'team_id': self.team['id'], 'remove_method': 'team_deleted', 'user_id': self.user_info['user_id']}}]
        with self.assert_events_match_during(event_filter=self.only_team_events, expected_events=expected_events):
            confirm_prompt(self.team_management_page, **kwargs)
