'Check that `remove_user_from_cohort` properly removes a user from a
cohort and returns appropriate success.  If the removal should fail,
verify that the returned error message matches the expected one.'

def verify_removed_user_from_cohort(self, username, response_dict, cohort, expected_error_msg=None):

    if (expected_error_msg is None):
        self.assertTrue(response_dict.get('success'))
        self.assertIsNone(response_dict.get('msg'))
        self.assertFalse(self._user_in_cohort(username, cohort))
    else:
        self.assertFalse(response_dict.get('success'))
        self.assertEqual(response_dict.get('msg'), expected_error_msg)
