When shell is True, Popen will only accept strings. No tuples
    Shell really should not be true.

    Returns:
        args suitable for subprocess.Popen

        I'm not quite sure what those are yet. Plain old string seem to work
        well? But I remember needing shlex at some point.

    CommandLine:
        python -m utool.util_cplat --test-__parse_cmd_args

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cplat import *  # NOQA
        >>> # build test data
        >>> args = 'echo "hello world"'
        >>> sudo = False
        >>> shell = False
        >>> # execute function
        >>> args = __parse_cmd_args(args, sudo, shell)
        >>> # verify results
        >>> result = str(args)
        >>> print(result)

def __parse_cmd_args(args, sudo, shell):
    """
    When shell is True, Popen will only accept strings. No tuples
    Shell really should not be true.

    Returns:
        args suitable for subprocess.Popen

        I'm not quite sure what those are yet. Plain old string seem to work
        well? But I remember needing shlex at some point.

    CommandLine:
        python -m utool.util_cplat --test-__parse_cmd_args

    Example:
        >>> # DISABLE_DOCTEST
        >>> from utool.util_cplat import *  # NOQA
        >>> # build test data
        >>> args = 'echo "hello world"'
        >>> sudo = False
        >>> shell = False
        >>> # execute function
        >>> args = __parse_cmd_args(args, sudo, shell)
        >>> # verify results
        >>> result = str(args)
        >>> print(result)
    """
    # Case where tuple is passed in as only argument
    if isinstance(args, tuple) and len(args) == 1 and isinstance(args[0], tuple):
        args = args[0]

    if shell:
        # When shell is True, ensure args is a string
        if isinstance(args, six.string_types):
            pass
        elif  isinstance(args, (list, tuple)) and len(args) > 1:
            args = ' '.join(args)
        elif isinstance(args, (list, tuple)) and len(args) == 1:
            if isinstance(args[0], (tuple, list)):
                args = ' '.join(args)
            elif isinstance(args[0], six.string_types):
                args = args[0]
    else:
        # When shell is False, ensure args is a tuple
        if isinstance(args, six.string_types):
            args = shlex.split(args, posix=not WIN32)
        elif isinstance(args, (list, tuple)):
            if len(args) > 1:
                args = tuple(args)
            elif len(args) == 1:
                if isinstance(args[0], (tuple, list)):
                    args = tuple(args[0])
                elif isinstance(args[0], six.string_types):
                    args = shlex.split(args[0], posix=not WIN32)
    if sudo is True:
        if not WIN32:
            if shell:
                args = 'sudo ' + args
            else:
                args = tuple(['sudo']) + tuple(args)
            #if isinstance(args, six.string_types):
            #    args = shlex.split(args)
            #args = ['sudo'] + args
            ## using sudo means we need to use a single string I believe
            #args = ' '.join(args)
        else:
            # TODO: strip out sudos
            pass
    # HACK FOR WINDOWS AGAIN
    # makes  this command work:
    # python -c "import utool as ut; ut.cmd('build\\hesaffexe.exe ' + ut.grab_test_imgpath('star.png'))"
    # and this should still work
    # python -c "import utool as ut; ut.cmd('build\\hesaffexe.exe', ut.grab_test_imgpath('star.png'))"
    if WIN32:
        if len(args) == 1 and isinstance(args[0], six.string_types):
            args = shlex.split(args[0], posix=not WIN32)
    return args