Returns the "ident" of a label.

    If ``subtopic`` is ``True``, then a pair of pairs is returned,
    where each pair corresponds to the content id and subtopic id in
    the given label.

    Otherwise, a pair of pairs is returned, but the second element of each
    pair is always ``None``.

    This is a helper function that is useful for dealing with generic
    label identifiers.

def idents_from_label(lab, subtopic=False):
    '''Returns the "ident" of a label.

    If ``subtopic`` is ``True``, then a pair of pairs is returned,
    where each pair corresponds to the content id and subtopic id in
    the given label.

    Otherwise, a pair of pairs is returned, but the second element of each
    pair is always ``None``.

    This is a helper function that is useful for dealing with generic
    label identifiers.
    '''
    if not subtopic:
        return (lab.content_id1, None), (lab.content_id2, None)
    else:
        return (
            (lab.content_id1, lab.subtopic_id1),
            (lab.content_id2, lab.subtopic_id2),
        )