def get_object_from_identifier(identifier, valid=None):
    try:
        model_str, pk = identifier.split('__')
    except ValueError:
        raise StoreException('Invalid identifier string')

    Model = get_model(*model_str.split('.'))
    if Model is None:
        raise StoreException('Model from identifier string "%s" not found' % model_str)

    if valid is not None:
        if not isinstance(valid, (list, tuple) ):
            valid = (valid,)
        if Model not in valid:
            raise StoreException('Model type mismatch')

    # This will raise Model.DoesNotExist if lookup fails
    return Model._default_manager.get(pk=pk)
Helper function to resolve an item identifier
dataset/ETHPy150Open klipstein/dojango/dojango/data/modelstore/utils.py/get_object_from_identifier