##### SUMMARY
See https://github.com/ansible/ansible/blob/88d8cf8197c53edd3bcdcd21429eb4c2bfbf0f6a/lib/ansible/module_utils/basic.py#L699-L706

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
lib/ansible/module_utils/basic.py

##### ANSIBLE VERSION
```paste below
2.9
devel
```

''' return from the module, without error '''
        self.do_cleanup_files()
        self._return_formatted(kwargs)
        sys.exit(0)
    def fail_json(self, **kwargs):
        ''' return from the module, with an error message '''
        if 'msg' not in kwargs:
            raise AssertionError("implementation error -- msg to explain the error is required")
        kwargs['failed'] = True
        
        
        if 'exception' not in kwargs and sys.exc_info()[2] and (self._debug or self._verbosity >= 3):
            if PY2:
                
                kwargs['exception'] = 'WARNING: The below traceback may *not* be related to the actual failure.\n' +\
                                      ''.join(traceback.format_tb(sys.exc_info()[2]))
            else:
                kwargs['exception'] = ''.join(traceback.format_tb(sys.exc_info()[2]))
        self.do_cleanup_files()
        self._return_formatted(kwargs)
        sys.exit(1)
    def fail_on_missing_params(self, required_params=None):
        if not required_params:
            return
        try:
            check_missing_parameters(self.params, required_params)
        except TypeError as e:
            self.fail_json(msg=to_native(e))
    def digest_from_file(self, filename, algorithm):