def METHOD_NAME(did, data_types, did_data_lib):
    """Load given DID element and return a did object.
    """
    offset = 0
    datas = []
    data_objs = did.findall('SIMPLECOMPCONT/DATAOBJ')
    data_objs += did.findall('SIMPLECOMPCONT/UNION/STRUCT/DATAOBJ')
    did_data_refs = did.findall('SIMPLECOMPCONT/DIDDATAREF')
    for data_ref in did_data_refs:
        try:
            data_objs += did_data_lib[data_ref.attrib['didRef']].findall('STRUCTURE/DATAOBJ')
        except KeyError:
            pass
    for data_obj in data_objs:
        data = _load_data_element(data_obj,
                                  offset,
                                  data_types)
        if data:
            datas.append(data)
            offset += data.length
    identifier = int(did.find('STATICVALUE').attrib['v'])
    name = did.find('QUAL').text
    length = (offset + 7) // 8
    return Did(identifier=identifier,
               name=name,
               length=length,
               datas=datas)