def METHOD_NAME(obj, info, code):
    qs = LocaleModel.objects
    fields = get_fields(info)
    if "locale.localizations" in fields:
        qs = qs.prefetch_related("project_locale__project")
    if "locale.localizations.project.localizations" in fields:
        raise Exception("Cyclic queries are forbidden")
    return qs.get(code=code)