def load_reference(name, element_type, version):
    """
    Look for an element of the given type, name and version and return its reference structure

    :type element_type: ``str``
    :param element_type: the element type to look for (e.g. 'Segment')
    :type name: ``str``
    :param name: the element name to look for (e.g. 'MSH')
    :type version: ``str``
    :param version: the version of the library where to search the element (e.g. '2.6')
    :rtype: ``dict``
    :return: a dictionary describing the element structure
    :raise: ``KeyError`` if the element has not been found

    The returned dictionary will contain the following keys:

    +--------------+--------------------------------------------+
    |Key           |Value                                       |
    +==============+============================================+
    |cls           |an :class:`hl7apy.core.Element` subclass    |
    +--------------+--------------------------------------------+
    |name          |the Element name (e.g. PID)                 |
    +--------------+--------------------------------------------+
    |ref           |a tuple of one of the following format:     |
    |              |                                            |
    |              |('leaf', <datatype>, <longName>, <table>)   |
    |              |('sequence', (<child>, (<min>, <max>), ...))|
    +--------------+--------------------------------------------+

    >>> load_reference('UNKNOWN', 'Segment', '2.5')  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    ...
    ChildNotFound: No child named UNKNOWN
    >>> r = load_reference('ADT_A01', 'Message', '2.5')
    >>> print(r[0])
    sequence
    >>> r = load_reference('MSH_3', 'Field', '2.5')
    >>> print(r[0])
    sequence
    """
    lib = load_library(version)
    ref = lib.get(name, element_type)
    return ref
Look for an element of the given type, name and version and return its reference structure

    :type element_type: ``str``
    :param element_type: the element type to look for (e.g. 'Segment')
    :type name: ``str``
    :param name: the element name to look for (e.g. 'MSH')
    :type version: ``str``
    :param version: the version of the library where to search the element (e.g. '2.6')
    :rtype: ``dict``
    :return: a dictionary describing the element structure
    :raise: ``KeyError`` if the element has not been found

    The returned dictionary will contain the following keys:

    +--------------+--------------------------------------------+
    |Key           |Value                                       |
    +==============+============================================+
    |cls           |an :class:`hl7apy.core.Element` subclass    |
    +--------------+--------------------------------------------+
    |name          |the Element name (e.g. PID)                 |
    +--------------+--------------------------------------------+
    |ref           |a tuple of one of the following format:     |
    |              |                                            |
    |              |('leaf', <datatype>, <longName>, <table>)   |
    |              |('sequence', (<child>, (<min>, <max>), ...))|
    +--------------+--------------------------------------------+

    >>> load_reference('UNKNOWN', 'Segment', '2.5')  # doctest: +IGNORE_EXCEPTION_DETAIL
    Traceback (most recent call last):
    ...
    ChildNotFound: No child named UNKNOWN
    >>> r = load_reference('ADT_A01', 'Message', '2.5')
    >>> print(r[0])
    sequence
    >>> r = load_reference('MSH_3', 'Field', '2.5')
    >>> print(r[0])
    sequence