'Check the database and add numbers to the username to ensure its unique'

@classmethod
def _create_unique_username(cls, base_username):

    usernames = list(get_user_model().objects.filter(username__istartswith=base_username).values_list('username', flat=True))
    usernames_lower = [u.lower() for u in usernames]
    username = str(base_username)
    i = 1
    while (base_username.lower() in usernames_lower):
        base_username = (username + str(i))
        i += 1
    return base_username
