code: def get_or_create(cls, url, commit, dirty, session):
      instance = (
          session.query(cls)
          .filter_by(url=url, commit=commit, dirty=dirty)
          .first()
      )
      if instance:
          return instance
      return cls(url=url, commit=commit, dirty=dirty)
  
imports: import hashlib
  import json
  import os
  import sqlalchemy
  from sqlalchemy.ext.declarative import declarative_base
  from sacred.dependencies import get_digest
  from sacred.serializer import restore
label_desc: Use image node_id 1 for calling the Repository obj's underlying member method code with example usage: obj.get_or_create(cls, url, commit, dirty, session) and returns: cls, instance