@classmethod
    def unix_logins(cls, membership=None, first_name=None, last_name=None,
                    given_names=None):
        if membership:
            first_name = remove_accents(membership.person.first_name.lower())
            last_name = remove_accents(membership.person.last_name.lower())
            given_names = remove_accents(membership.person.given_names.lower())
        else:
            first_name = remove_accents(first_name.lower())
            last_name = remove_accents(last_name.lower())
            given_names = remove_accents(given_names.lower())

        permutations = []

        permutations.append(last_name)
        permutations.append(first_name)
        permutations.append(first_name + last_name)
        permutations.append(last_name + first_name)

        non_first_names = []
        initials = []
        for n in given_names.split(" "):
            if n != first_name:
                non_first_names.append(n)
                initials.append(n)

        permutations.append("".join(initials) + last_name[0])
        permutations.append("".join(initials) + last_name)

        for initial in initials:
            permutations.append(initial + last_name)

        return [perm for perm in permutations
                if cls.objects.filter(name__iexact=perm).count() == 0]
Returns a list of available user login names.
dataset/ETHPy150Open kapsiry/sikteeri/services/models.py/Alias.unix_logins