'Generalized method for getting this tool\'s job configuration.
:type job_params: dict or None
:returns: `galaxy.jobs.JobToolConfiguration` -- JobToolConfiguration that matches this `Tool` and the given `job_params`'

def __get_job_tool_configuration(self, job_params=None):

    rval = None
    if (len(self.job_tool_configurations) == 1):
        rval = self.job_tool_configurations[0]
    elif (job_params is None):
        for job_tool_config in self.job_tool_configurations:
            if (not job_tool_config.params):
                rval = job_tool_config
                break
    else:
        for job_tool_config in self.job_tool_configurations:
            if job_tool_config.params:
                for (param, value) in job_params.items():
                    if ((param not in job_tool_config.params) or (job_tool_config.params[param] != value)):
                        break
                else:
                    rval = job_tool_config
                    break
            else:
                rval = job_tool_config
    assert (rval is not None), ('Could    not    get    a    job    tool    configuration    for    Tool    %s    with    job_params    %s,    this    is    a    bug' % (self.id, job_params))
    return rval
