def account_is_active(cls, user_id): # detect activity on a user account result = False has_friends = True if EnkiModelFriends.fetch_by_user_id( user_id) else False has_messages = True if EnkiModelMessage.exist_sent_or_received( user_id) else False has_forum_posts = True if EnkiModelPost.fetch_by_author( user_id) else False has_product = True if EnkiModelProductKey.exist_by_purchaser_or_activator( user_id) else False has_email_subscriptions = False email = ndb.Key(EnkiModelUser, user_id).get().email if email: has_email_subscriptions = True if EnkiModelEmailSubscriptions.exist_by_email( email) else False if has_friends or has_messages or has_forum_posts or has_product or has_email_subscriptions: result = True return result