<!--- Verify first that your issue is not already reported on GitHub -->
<!--- Also test if the latest release and devel branch are affected too -->
<!--- Complete *all* sections as described, this form is processed automatically -->

##### SUMMARY
My self written module output includes a datetime.date object. This results in a type error here: https://github.com/ansible/ansible/blob/adcdee9bb0031577698246fcfc51f8af63a56a17/lib/ansible/module_utils/basic.py#L397

##### ISSUE TYPE
- Bug Report

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

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes -->
```paste below
ansible 2.9.6
```

##### CONFIGURATION
<!--- Paste verbatim output from "ansible-config dump --only-changed" between quotes -->
```paste below

```

##### OS / ENVIRONMENT
<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->
python3

##### STEPS TO REPRODUCE
<!--- Describe exactly how to reproduce the problem, using a minimal test-case -->

library/my_test.py
```python
from ansible.module_utils.basic import AnsibleModule
import datetime

if __name__ == '__main__':
    module = AnsibleModule(argument_spec=dict())
    module.exit_json(result={'test_date': datetime.datetime.now().date()})
```

<!--- Paste example playbooks or commands between quotes below -->
```yaml
- name: test
  hosts: all
  tasks:
  - my_test:
    register: out
```

<!--- HINT: You can paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
Running through without an error


##### ACTUAL RESULTS
<!--- Describe what actually happened. If possible run with extra verbosity (-vvvv) -->
The module fails with an exception
<!--- Paste verbatim command output between quotes -->
```paste below
$ ansible-playbook -i localhost, -c local test.yml

PLAY [test] ************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************
ok: [localhost]

TASK [my_test] *********************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: Value of unknown type: <class 'datetime.date'>, 2020-07-12
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/jdrummer/.ansible/tmp/ansible-tmp-1594559282.5458276-140886794481795/AnsiballZ_my_test.py\", line 102, in <module>\n    _ansiballz_main()\n  File \"/home/jdrummer/.ansible/tmp/ansible-tmp-1594559282.5458276-140886794481795/AnsiballZ_my_test.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/jdrummer/.ansible/tmp/ansible-tmp-1594559282.5458276-140886794481795/AnsiballZ_my_test.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.my_test', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python3.8/runpy.py\", line 206, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.8/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.8/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_my_test_payload_eacypa5q/ansible_my_test_payload.zip/ansible/modules/my_test.py\", line 6, in <module>\n  File \"/tmp/ansible_my_test_payload_eacypa5q/ansible_my_test_payload.zip/ansible/module_utils/basic.py\", line 2071, in exit_json\n  File \"/tmp/ansible_my_test_payload_eacypa5q/ansible_my_test_payload.zip/ansible/module_utils/basic.py\", line 2064, in _return_formatted\n  File \"/tmp/ansible_my_test_payload_eacypa5q/ansible_my_test_payload.zip/ansible/module_utils/basic.py\", line 418, in remove_values\n  File \"/tmp/ansible_my_test_payload_eacypa5q/ansible_my_test_payload.zip/ansible/module_utils/basic.py\", line 401, in _remove_values_conditions\nTypeError: Value of unknown type: <class 'datetime.date'>, 2020-07-12\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP *************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
```

'''atomically move src to dest, copying attributes from dest, returns true on success
        it uses os.rename to ensure this as it is an atomic operation, rest of the function is
        to work around limitations, corner cases and ensure selinux context is saved if possible'''
        context = None
        dest_stat = None
        b_src = to_bytes(src, errors='surrogate_or_strict')
        b_dest = to_bytes(dest, errors='surrogate_or_strict')
        if os.path.exists(b_dest):
            try:
                dest_stat = os.stat(b_dest)
                
                os.chmod(b_src, dest_stat.st_mode & PERM_BITS)
                os.chown(b_src, dest_stat.st_uid, dest_stat.st_gid)
                
                if hasattr(os, 'chflags') and hasattr(dest_stat, 'st_flags'):
                    try:
                        os.chflags(b_src, dest_stat.st_flags)
                    except OSError as e:
                        for err in 'EOPNOTSUPP', 'ENOTSUP':
                            if hasattr(errno, err) and e.errno == getattr(errno, err):
                                break
                        else:
                            raise
            except OSError as e: