+def IsRetired(DnRecord):
+ """
+ Looks for accountStatus in the LDAP record and tries to
+ match it against one of the known retired statuses
+ """
+
+ status = GetAttr(DnRecord,"accountStatus", None)
+ if status is None:
+ return False
+
+ if status.find("inactive") != -1:
+ return True
+
+ if status.find("memorial") != -1:
+ return True
+
+ if status.find("retiring") != -1:
+ line = status.split()
+ # We'll give them a few extra days over what we said
+ age = 6 * 31 * 24 * 60 * 60
+ if (time.time() - time.mktime(time.strptime(line[1], "%Y-%m-%d")) > (age):
+ return True
+
+ return False
+