def mock_ansible_module(ansible_mod_cls, params, check_mode):
    """
    Prepare mocks for AnsibleModule object.
    """
    mod_obj = ansible_mod_cls.return_value
    mod_obj.params = params
    mod_obj.check_mode = check_mode
    mod_obj.fail_json.configure_mock(side_effect=SystemExit(1))
    mod_obj.exit_json.configure_mock(side_effect=SystemExit(0))
    return mod_obj