# Buggy code
def raw_cron(user):
    """
    Return the contents of the user's crontab

    CLI Example:

    .. code-block:: bash

        salt '*' cron.raw_cron root
    """
    if _check_instance_uid_match(user) or __grains__.get("os_family") in (
        "Solaris",
        "AIX",
    ):
        cmd = "crontab -l"
        # Preserve line endings
        lines = __salt__["cmd.run_stdout"](
            cmd, runas=user, rstrip=False, python_shell=False
        ).splitlines(True)
    else:
        cmd = "crontab -u {0} -l".format(user)
        # Preserve line endings
        lines = __salt__["cmd.run_stdout"](
            cmd, rstrip=False, python_shell=False
        ).splitlines(True)

    if len(lines) != 0 and lines[0].startswith(
        "# DO NOT EDIT THIS FILE - edit the master and reinstall."
    ):
        del lines[0:3]
    return "".join(lines)


# Traceback (ValueError)
Function: cron.present
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/state.py", line 1820, in call
**cdata['kwargs'])
File "/usr/lib/python3.6/site-packages/salt/loader.py", line 1724, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/states/cron.py", line 335, in present
identifier=identifier)
File "/usr/lib/python3.6/site-packages/salt/modules/cron.py", line 461, in set_job
lst = list_tab(user)
File "/usr/lib/python3.6/site-packages/salt/modules/cron.py", line 293, in list_tab
data = raw_cron(user)
File "/usr/lib/python3.6/site-packages/salt/modules/cron.py", line 270, in raw_cron
python_shell=False).splitlines(True)
File "/usr/lib/python3.6/site-packages/salt/modules/cmdmod.py", line 1289, in run_stdout
**kwargs)
File "/usr/lib/python3.6/site-packages/salt/modules/cmdmod.py", line 540, in _run
proc = salt.utils.timed_subprocess.TimedProc(cmd, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/utils/timed_subprocess.py", line 41, in __init__
self.process = subprocess.Popen(args, **kwargs)
File "/usr/lib/python3.6/subprocess.py", line 707, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1251, in _execute_child
for dir in os.get_exec_path(env))
File "/usr/lib/python3.6/os.py", line 640, in get_exec_path
"env cannot contain 'PATH' and b'PATH' keys")
ValueError: env cannot contain 'PATH' and b'PATH' keys

# Fixed code
def raw_cron(user):
    """
    Return the contents of the user's crontab

    CLI Example:

    .. code-block:: bash

        salt '*' cron.raw_cron root
    """
    if _check_instance_uid_match(user) or __grains__.get("os_family") in (
        "Solaris",
        "AIX",
    ):
        cmd = "crontab -l"
        # Preserve line endings
        lines = sdecode(
            __salt__["cmd.run_stdout"](
                cmd, runas=user, rstrip=False, python_shell=False
            )
        ).splitlines(True)
    else:
        cmd = "crontab -u {0} -l".format(user)
        # Preserve line endings
        lines = sdecode(
            __salt__["cmd.run_stdout"](cmd, rstrip=False, python_shell=False)
        ).splitlines(True)

    if len(lines) != 0 and lines[0].startswith(
        "# DO NOT EDIT THIS FILE - edit the master and reinstall."
    ):
        del lines[0:3]
    return "".join(lines)