Register a new user from google.
    This can raise `exc.IntegrityError` exceptions in
    case of conflics found.
    :returns: User

def google_register(username:str, email:str, full_name:str, google_id:int, bio:str, token:str=None):
    """
    Register a new user from google.
    This can raise `exc.IntegrityError` exceptions in
    case of conflics found.
    :returns: User
    """
    auth_data_model = apps.get_model("users", "AuthData")
    user_model = apps.get_model("users", "User")

    try:
        # Google user association exist?
        auth_data = auth_data_model.objects.get(key="google", value=google_id)
        user = auth_data.user
    except auth_data_model.DoesNotExist:
        try:
            # Is a user with the same email as the google user?
            user = user_model.objects.get(email=email)
            auth_data_model.objects.create(user=user, key="google", value=google_id, extra={})
        except user_model.DoesNotExist:
            # Create a new user
            username_unique = slugify_uniquely(username, user_model, slugfield="username")
            user = user_model.objects.create(email=email,
                                             username=username_unique,
                                             full_name=full_name,
                                             bio=bio)
            auth_data_model.objects.create(user=user, key="google", value=google_id, extra={})

            send_register_email(user)
            user_registered_signal.send(sender=user.__class__, user=user)

    if token:
        membership = get_membership_by_token(token)
        membership.user = user
        membership.save(update_fields=["user"])

    return user