### 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
platform = 'Linux'
    distribution = 'Altlinux'
    strategy_class = RedHatStrategy
class AlpineLinuxHostname(Hostname):
    platform = 'Linux'
    distribution = 'Alpine'
    strategy_class = AlpineStrategy
class OpenBSDHostname(Hostname):
    platform = 'OpenBSD'
    distribution = None
    strategy_class = OpenBSDStrategy
class SolarisHostname(Hostname):
    platform = 'SunOS'
    distribution = None
    strategy_class = SolarisStrategy
class FreeBSDHostname(Hostname):
    platform = 'FreeBSD'
    distribution = None
    strategy_class = FreeBSDStrategy
class NetBSDHostname(Hostname):
    platform = 'NetBSD'
    distribution = None
    strategy_class = FreeBSDStrategy
class NeonHostname(Hostname):
    platform = 'Linux'
    distribution = 'Neon'
    strategy_class = FileStrategy
class DarwinHostname(Hostname):