+# helpers to handle external objects created via fedaration
+
+
+def top_auth(hrn):
+ return hrn.split('.')[0]
+
+
+def hash_loginbase(site_hrn):
+ if len(site_hrn) <= 12:
+ return site_hrn.replace('.', '8').replace('_', '8')
+ ratio = float(12) / len(site_hrn)
+ auths_tab = site_hrn.split('.')
+ auths_tab2 = []
+ for auth in auths_tab:
+
+ auth = auth.replace('_', '8')
+ auth2 = auth[:int(len(auth) * ratio)]
+ auths_tab2.append(auth2)
+ return '8'.join(auths_tab2)
+
+