def get_model_by_resource_ref(db_api, ref):
 ref_obj = ResourceReference.from_string_reference(ref=ref)
 result = db_api.query(name=ref_obj.name, pack=ref_obj.pack).first()
 return result

def get_model_by_resource_ref ( db_api , ref ) : ref_obj = ResourceReference . from_string_reference ( ref = ref ) result = db_api . query ( name = ref_obj . name , pack = ref_obj . pack ) . first ( ) return result
retrieve a db model based on the resource reference .