def build_command_list(command, param_list, include_keys=True):
    """
    build_command_list builds a list to be used by subprocess.Popen with the
    ParamList providing key/value pairs for command-line parameters.
    ParamList is a dictionary of key:value pairs to be put into the command
    list as such

    Args:
        command (list): A list containing the base command (e.g. ['ls']) with
            parameters that are always used.

        param_list (dict): An dictionary (usually ordered) of key/value pairs
            representing command-line parameters/switches for the command in
            question. Results in ("-k value" or "--key=value")

        include_keys (bool, optional): A flag to indicate whether or not to
            include the keys in the command list. Defaults to True.

    Returns:
        list: returns the completed command-list expected by subprocess.Popen

    Example:
        .. code-block:: python

            command = ['du']
            params = {'a': '', 'human-readable': True, 'max-depth': 3}
            command = build_command_list(command, params)

        results in

        ``['du', '-a', '--human-readable', '--max-depth=3']``
    """
    for key in param_list.keys():
        if len(key) == 1:
            if isinstance(param_list[key], bool) and param_list[key]:
                command.append('-' + key)
            else:
                if include_keys:
                    command.append('-' + key)
                if str(param_list[key]):
                    command.append(str(param_list[key]))
        elif isinstance(param_list[key], bool):
            if param_list[key] and include_keys:
                command.append('--' + key)
        else:
            item = ''
            if include_keys:
                item = '--' + key
            if str(param_list[key]):
                if include_keys:
                    item = item + '='
                item = item + str(param_list[key])
            command.append(item)
    return command
