def LBHref(thisDoc, prefix, name):
    if ((not prefix) and (name in modelXbrl.nameConcepts)):
        _concept = modelXbrl.nameConcepts[name][0]
        filename = _concept.modelDocument.uri
        prefix = _concept.qname.prefix
    elif (prefix == thisDoc.extensionSchemaPrefix):
        filename = thisDoc.extensionSchemaFilename
    elif (prefix in thisDoc.importFilenames):
        filename = thisDoc.importFilenames[prefix]
    elif (prefix in genDocs):
        doc = genDocs[prefix]
        if (not doc.generated):
            generateDoc(doc, thisDoc)
        if doc.generated:
            filename = doc.extensionSchemaFilename
        else:
            return None
    elif (name in modelXbrl.nameConcepts):
        filename = None
        for _concept in modelXbrl.nameConcepts[name]:
            if (prefix == _concept.qname.prefix):
                filename = _concept.modelDocument.uri
                break
        if (not filename):
            return None
    else:
        return None
    return '{0}#{1}_{2}'.format(docRelpath(filename, thisDoc.thisLBdir), prefix, name)
def LBHref(thisDoc, prefix, name):
    if ((not prefix) and (name in modelXbrl.nameConcepts)):
        _concept = modelXbrl.nameConcepts[name][0]
        filename = _concept.modelDocument.uri
        prefix = _concept.qname.prefix
    elif (prefix == thisDoc.extensionSchemaPrefix):
        filename = thisDoc.extensionSchemaFilename
    elif (prefix in thisDoc.importFilenames):
        filename = thisDoc.importFilenames[prefix]
    elif (prefix in genDocs):
        doc = genDocs[prefix]
        if (not doc.generated):
            generateDoc(doc, thisDoc)
        if doc.generated:
            filename = doc.extensionSchemaFilename
        else:
            return None
    elif (name in modelXbrl.nameConcepts):
        filename = None
        for _concept in modelXbrl.nameConcepts[name]:
            if (prefix == _concept.qname.prefix):
                filename = _concept.modelDocument.uri
                break
        if (not filename):
            return None
    else:
        return None
    return '{0}#{1}_{2}'.format(docRelpath(filename, thisDoc.thisLBdir), prefix, name)