

def get_or_create_storage_file(node, path, **kwargs):
    'Get or create `OsfStorageGuidFile` record. Used instead of\n    `OsfStorageGuidFile#get_or_create` to permit setting additional fields on\n    the created object.\n    '
    try:
        return OsfStorageGuidFile.find_one((Q('node', 'eq', node) & Q('path', 'eq', path)))
    except modm_errors.ModularOdmException as error:
        obj = OsfStorageGuidFile(node=node, path=path, **kwargs)
        obj.save()
    return obj

dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/osfstorage/migrate_guids.py get_or_create_storage_file/original