def METHOD_NAME(value, check_username_available=True):
    """
    Check if username is used by another user
    :param value: value to validate (str or None)
    :return:
    """
    # If the character \x00 is in the username, the homoglyphs library called
    # in Profile.find_username_skeleton() will raise a ValueError (the bug has
    # been reported: https://github.com/yamatt/homoglyphs/issues/6). To prevent
    # this, we call this validator which will raise a ValidationError if \x00 is
    # in the username.
    ProhibitNullCharactersValidator()(value)
    msg = None
    user_count = User.objects.filter(username=value).count()
    skeleton_user_count = Profile.objects.filter(username_skeleton=Profile.find_username_skeleton(value)).count()
    if "," in value:
        msg = _("Le nom d'utilisateur ne peut contenir de virgules")
    elif "/" in value:
        msg = _("Le nom d'utilisateur ne peut contenir de barres obliques")
    elif contains_utf8mb4(value):
        msg = _("Le nom d'utilisateur ne peut pas contenir des caractères utf8mb4")
    elif check_username_available and user_count > 0:
        msg = _("Ce nom d'utilisateur est déjà utilisé")
    elif check_username_available and skeleton_user_count > 0:
        msg = _("Un nom d'utilisateur visuellement proche du votre existe déjà")
    elif not check_username_available and user_count == 0:
        msg = _("Ce nom d'utilisateur n'existe pas")
    if msg is not None:
        raise ValidationError(msg)