def get_latest_repository_metadata_if_it_includes_invalid_tools(trans, repository):
 repository_metadata = get_latest_repository_metadata(trans, repository)
 if (repository_metadata is not None):
  metadata = repository_metadata.metadata
  if ((metadata is not None) and ('invalid_tools' in metadata)):
   return repository_metadata
 return None

def get_latest_repository_metadata_if_it_includes_invalid_tools ( trans , repository ) : repository_metadata = get_latest_repository_metadata ( trans , repository ) if ( repository_metadata is not None ) : metadata = repository_metadata . metadata if ( ( metadata is not None ) and ( 'invalid_tools' in metadata ) ) : return repository_metadata return None
return the latest repository_metadata record for the received repository that contains invalid tools if one exists .