'Return a tool shed repository database record defined by the combination of
tool shed, repository name, repository owner and changeset_revision or
installed_changeset_revision.  A new tool shed repository record will be
created if one is not located.'

def get_or_create_tool_shed_repository(self, tool_shed, name, owner, changeset_revision):

    install_model = self.app.install_model
    tool_shed = common_util.remove_protocol_from_tool_shed_url(tool_shed)
    repository = repository_util.get_repository_for_dependency_relationship(self.app, tool_shed, name, owner, changeset_revision)
    if (not repository):
        tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry(self.app, tool_shed)
        repository_clone_url = os.path.join(tool_shed_url, 'repos', owner, name)
        ctx_rev = suc.get_ctx_rev(self.app, tool_shed_url, name, owner, changeset_revision)
        repository = repository_util.create_or_update_tool_shed_repository(app=self.app, name=name, description=None, installed_changeset_revision=changeset_revision, ctx_rev=ctx_rev, repository_clone_url=repository_clone_url, metadata_dict={}, status=install_model.ToolShedRepository.installation_status.NEW, current_changeset_revision=None, owner=owner, dist_to_shed=False)
    return repository
