def get_single_element_by_tag_name(node, tag_name, optional=False):
    """
    Returns an element that is a child of the given node and that 
    has the tag name given. This method is used where it is assumed
    that one such tag exists.
    If there is none, an exception is 
    raised. If there is more than one, the first is returned.