'Given a tool id, return XML elements describing parameters to
insert into job resources.
:tool id: A tool ID (a string)
:tool type: A tool type (a string)
:returns: List of parameter elements.'

def get_tool_resource_xml(self, tool_id, tool_type):

    if (tool_id and (tool_type is 'default')):
        resource_group = None
        if (tool_id in self.tools):
            resource_group = self.tools[tool_id][0].get_resource_group()
        resource_group = (resource_group or self.default_resource_group)
        if (resource_group and (resource_group in self.resource_groups)):
            fields_names = self.resource_groups[resource_group]
            fields = [self.resource_parameters[n] for n in fields_names]
            if fields:
                conditional_element = ElementTree.fromstring(self.JOB_RESOURCE_CONDITIONAL_XML)
                when_yes_elem = conditional_element.findall('when')[1]
                for parameter in fields:
                    when_yes_elem.append(parameter)
                return conditional_element
