code: def get_or_create(cls, filename, session):
      md5sum = get_digest(filename)
      instance = (
          session.query(cls)
          .filter_by(filename=filename, md5sum=md5sum)
          .first()
      )
      if instance:
          return instance
      with open(filename, "rb") as f:
          return cls(filename=filename, md5sum=md5sum, content=f.read())
  
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 Resource obj's underlying member method code with example usage: obj.get_or_create(cls, filename, session) and returns: instance, cls