def validate_wildcard_right(name):
    """
    Validate a name query using the wildcard_right option and add the correct
    wildcard syntax if needed

    :param name: String
    :return: String
    """

    if name[0] == "*":
        raise Exception(
            "Wildcard right lookup cannot start with an asterisk " "on the " "left side"
        )

    # Correct wildcard syntax, do nothing
    if name[-1] == "*" and name[-2] == ".":
        return name
    # Missing asterisk, add
    if name[-1] == ".":
        return name + "*"
    # Missing asterisk and dot, add
    return name + ".*"