def find_text_in_element(element, tag: str) -> str:
    """
    Find a text in an XML element.

    Args:
        element (Element): XML element.
        tag (str): the XML tag to search for.

    Returns:
        str: the text of the tag that was searched.
    """
    result = element.find(tag)
    # This has to be an exact check, as an element that has no text will evaluate to none.
    if result is None:
        raise LookupError(f"Tag {tag} not found in element.")

    if not hasattr(result, "text"):
        raise LookupError(f"Tag {tag} has no text.")

    return result.text if result.text else ""