def build_subpart(text, part):
    results = marker_subpart_title.parseString(text)
    subpart_letter = results.subpart
    subpart_title = results.subpart_title
    label = [str(part), 'Subpart', subpart_letter]

    return struct.Node(
        "", [], label, subpart_title, node_type=struct.Node.SUBPART)
def build_subpart(text, part):
    results = marker_subpart_title.parseString(text)
    subpart_letter = results.subpart
    subpart_title = results.subpart_title
    label = [str(part), 'Subpart', subpart_letter]

    return struct.Node("", [],
                       label,
                       subpart_title,
                       node_type=struct.Node.SUBPART)
def build_subpart(text, part):
    try:
        results = marker_subpart_title.parseString(text)
        subpart_letter = results.subpart
        subpart_title = results.subpart_title
        label = [str(part), 'Subpart', subpart_letter]

        return struct.Node(
            "", [], label, subpart_title, node_type=struct.Node.SUBPART)

    except ParseException:
        """ Return a dummy node, since this is likely a case where subparts are
        reserved for future use."""
        results = marker_subparts_title.parseString(text)
        label = [str(part), 'Subpart', results[0]]
        logger.warn("Could not parse subpart from text: {0}. Parsing as \
        reserved subparts {1}".format(text, results[0]))
        return struct.Node(
            '', [], label, '', node_type=struct.Node.EMPTYPART)