### Summary

The [`RedHatStrategy` class in `lib/ansible/modules/hostname.py`](https://github.com/ansible/ansible/blob/c5d8dc0e119c8a1632afae8b55fb15e2a4a44177/lib/ansible/modules/hostname.py#L283-L318) does not follow the [Unicode Sandwich principles](https://docs.ansible.com/ansible/latest/dev_guide/developing_python_3.html#unicode-sandwich-common-borders-places-to-convert-bytes-to-text-in-controller-code) and so runs into an exception when the module is executed with Python 3:

```python
Traceback (most recent call last):
  File "/tmp/ansible_hostname_payload_zjjaaj3t/ansible_hostname_payload.zip/ansible/modules/hostname.py", line 315, in get_permanent_hostname
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
```


### Issue Type

Bug Report

### Component Name

ansible.builtin.hostname

### Ansible Version

```console
$ ansible --version
ansible [core 2.11.5]
  config file = None
  configured module search path = ['/Users/mj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/4.6.0/libexec/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/mj/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.7 (default, Sep  3 2021, 12:37:55) [Clang 12.0.5 (clang-1205.0.22.9)]
  jinja version = 3.0.1
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed
```


### OS / Environment

CentOS 8 Stream


### Steps to Reproduce

The following commands start a CentOS 8 docker container in the background, then attempts to set the hostname on that container; the last command removes the container again:

```sh
docker run -d --rm --cap-add SYS_ADMIN --name mcve-hostname centos:8 /bin/sh -c 'while true; do sleep 5; done'
ansible -i mcve-hostname, -c docker -m ansible.builtin.hostname -a 'name=mcve-hostname use=redhat' all -vvvv
docker stop mcve-hostname
```

Note: the `--cap-add SYS_ADMIN` option for `docker run` is used to [allow the `hostname` command to be used](https://github.com/moby/moby/issues/8902#issuecomment-218911749).

### Expected Results

I expected the hostname command to run without issue.

### Actual Results

```console
ansible [core 2.11.5]
  config file = None
  configured module search path = ['/Users/mj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/4.6.0/libexec/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/mj/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.7 (default, Sep  3 2021, 12:37:55) [Clang 12.0.5 (clang-1205.0.22.9)]
  jinja version = 3.0.1
  libyaml = True
No config file found; using defaults
setting up inventory plugins
Parsed mcve-hostname, inventory source with host_list plugin
Loading callback plugin minimal of type stdout, v2.0 from /usr/local/Cellar/ansible/4.6.0/libexec/lib/python3.9/site-packages/ansible/plugins/callback/minimal.py
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
redirecting (type: connection) ansible.builtin.docker to community.docker.docker
Loading collection community.docker from /Users/mj/.ansible/collections/ansible_collections/community/docker
<mcve-hostname> ESTABLISH DOCKER CONNECTION FOR USER: root
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', "/bin/sh -c 'echo ~ && sleep 0'"]
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259 `" && echo ansible-tmp-1634119089.8989718-55435-22274985961259="` echo /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259 `" ) && sleep 0\'']
<mcve-hostname> Attempting python interpreter discovery
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', '/bin/sh -c \'echo PLATFORM; uname; echo FOUND; command -v \'"\'"\'/usr/bin/python\'"\'"\'; command -v \'"\'"\'python3.9\'"\'"\'; command -v \'"\'"\'python3.8\'"\'"\'; command -v \'"\'"\'python3.7\'"\'"\'; command -v \'"\'"\'python3.6\'"\'"\'; command -v \'"\'"\'python3.5\'"\'"\'; command -v \'"\'"\'python2.7\'"\'"\'; command -v \'"\'"\'python2.6\'"\'"\'; command -v \'"\'"\'/usr/libexec/platform-python\'"\'"\'; command -v \'"\'"\'/usr/bin/python3\'"\'"\'; command -v \'"\'"\'python\'"\'"\'; echo ENDFOUND && sleep 0\'']
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', "/bin/sh -c '/usr/libexec/platform-python && sleep 0'"]
Using module file /usr/local/Cellar/ansible/4.6.0/libexec/lib/python3.9/site-packages/ansible/modules/hostname.py
<mcve-hostname> PUT /Users/mj/.ansible/tmp/ansible-local-55433gdx_vwgr/tmp6ggw39on TO /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259/AnsiballZ_hostname.py
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', "/bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259/ /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259/AnsiballZ_hostname.py && sleep 0'"]
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', "/bin/sh -c '/usr/libexec/platform-python /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259/AnsiballZ_hostname.py && sleep 0'"]
<mcve-hostname> EXEC ['/usr/local/bin/docker', b'exec', b'-i', 'mcve-hostname', '/bin/sh', '-c', "/bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1634119089.8989718-55435-22274985961259/ > /dev/null 2>&1 && sleep 0'"]
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_ansible.builtin.hostname_payload_wgq1w34m/ansible_ansible.builtin.hostname_payload.zip/ansible/modules/hostname.py", line 315, in get_permanent_hostname
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
mcve-hostname | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "name": "mcve-hostname",
            "use": "redhat"
        }
    },
    "msg": "failed to read hostname: startswith first arg must be bytes or a tuple of bytes, not str"
}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
"""
    This is a macOS hostname manipulation strategy class. It uses
    /usr/sbin/scutil to set ComputerName, HostName, and LocalHostName.
    HostName corresponds to what most platforms consider to be hostname.
    It controls the name used on the command line and SSH.
    However, macOS also has LocalHostName and ComputerName settings.
    LocalHostName controls the Bonjour/ZeroConf name, used by services
    like AirDrop. This class implements a method, _scrub_hostname(), that mimics
    the transformations macOS makes on hostnames when enterened in the Sharing
    preference pane. It replaces spaces with dashes and removes all special
    characters.
    ComputerName is the name used for user-facing GUI services, like the
    System Preferences/Sharing pane and when users connect to the Mac over the network.
    """
    def __init__(self, module):
        super(DarwinStrategy, self).__init__(module)
        self.scutil = self.module.get_bin_path('scutil', True)
        self.name_types = ('HostName', 'ComputerName', 'LocalHostName')
        self.scrubbed_name = self._scrub_hostname(self.module.params['name'])
    def _make_translation(self, replace_chars, replacement_chars, delete_chars):