def METHOD_NAME(elements: List[Struct], attr_name: str, value: Any, filtered_data_type: Type[Struct] = None,
                regex: bool = False) -> Struct:
    """ Returns the one element from the given list whose specified attribute has the given value.
    An error is thrown is more than one or no element has been found.
    :param elements: A list of elements.
    :param attr_name: The name of the attribute to look for.
    :param value: The value the attribute should have.
    :param filtered_data_type: If not None, only elements from the given type are returned.
    :param regex: If True, string values will be matched via regex.
    :return: The one element from the given list that matches the given value at the specified attribute.
    """
    elements = by_attr(elements, attr_name, value, filtered_data_type, regex)
    return _Filter.check_list_has_length_one(elements)