'Get a list of valid and (optionally) invalid tool dicts from the repository metadata.'

def get_tools_from_repository_metadata(self, repository, include_invalid=False):

    valid_tools = []
    invalid_tools = []
    for repository_metadata in repository.metadata_revisions:
        if ('tools' in repository_metadata.metadata):
            valid_tools.append(dict(tools=repository_metadata.metadata['tools'], changeset_revision=repository_metadata.changeset_revision))
        if (include_invalid and ('invalid_tools' in repository_metadata.metadata)):
            invalid_tools.append(dict(tools=repository_metadata.metadata['invalid_tools'], changeset_revision=repository_metadata.changeset_revision))
    return (valid_tools, invalid_tools)
