def _qsub_args(self, override_options, cmd_args, append_options=[]):
        """
        Method to generate Popen style argument list for qsub using
        the qsub_switches and qsub_flag_options parameters. Switches
        are returned first. The qsub_flag_options follow in keys()
        ordered if not a vanilla Python dictionary (ie. a Python 2.7+
        or param.external OrderedDict).  Otherwise the keys are sorted
        alphanumerically. Note that override_options is a list of
        key-value pairs.
        """
        opt_dict = type(self.qsub_flag_options)()
        opt_dict.update(self.qsub_flag_options)
        opt_dict.update(override_options)

        if type(self.qsub_flag_options) == dict:   # Alphanumeric sort if vanilla Python dictionary
            ordered_options = [(k, opt_dict[k]) for k in sorted(opt_dict)]
        else:
            ordered_options =  list(opt_dict.items())

        ordered_options += append_options

        unpacked_groups = [[(k,v) for v in val] if type(val)==list else [(k,val)]
                           for (k,val) in ordered_options]
        unpacked_kvs = [el for group in unpacked_groups for el in group]

        # Adds '-' if missing (eg, keywords in dict constructor) and flattens lists.
        ordered_pairs = [(k,v) if (k[0]=='-') else ('-%s' % (k), v)
                         for (k,v) in unpacked_kvs]
        ordered_options = [[k]+([v] if type(v) == str else list(v)) for (k,v) in ordered_pairs]
        flattened_options = [el for kvs in ordered_options for el in kvs]

        return (['qsub'] + self.qsub_switches
                + flattened_options + [pipes.quote(c) for c in cmd_args])
Method to generate Popen style argument list for qsub using
        the qsub_switches and qsub_flag_options parameters. Switches
        are returned first. The qsub_flag_options follow in keys()
        ordered if not a vanilla Python dictionary (ie. a Python 2.7+
        or param.external OrderedDict).  Otherwise the keys are sorted
        alphanumerically. Note that override_options is a list of
        key-value pairs.