def get_unique_open_realm():
 if settings.REALMS_HAVE_SUBDOMAINS:
  return None
 realms = Realm.objects.filter(deactivated=False)
 realms = realms.exclude(string_id__in=settings.SYSTEM_ONLY_REALMS)
 if (len(realms) != 1):
  return None
 realm = realms[0]
 if (realm.invite_required or realm.restricted_to_domain):
  return None
 return realm

def get_unique_open_realm ( ) : if settings . REALMS_HAVE_SUBDOMAINS : return None realms = Realm . objects . filter ( deactivated = False ) realms = realms . exclude ( string_id__in = settings . SYSTEM_ONLY_REALMS ) if ( len ( realms ) != 1 ) : return None realm = realms [ 0 ] if ( realm . invite_required or realm . restricted_to_domain ) : return None return realm
we only return a realm if there is a unique non-system-only realm .