def __split_complex_exon(transcript, exon, texon, sentinel, boundary,
    invert=False):
    """
    Private method used to split an exon when it is only partially coding,
    :param exon: Exon to be analysed
    :param texon: Transcriptomic coordinates of the exon
    :param sentinel: tuple of boolean flags, it indicates whether there are transcripts on the left
    (first member) and/or on the right (second member) of the current instance.

    :param boundary: Transcriptomic coordinates of the ORF boundary.
    :return:
    """
    left, right = sentinel
    to_discard = None
    new_exon = list(exon)
    if texon[1] == boundary[0]:
        if left is False:
            transcript.logger.debug("Appending mixed UTR/CDS 5' exon %s", exon)
        elif transcript.strand == '+':
            to_discard = exon[0], exon[1] - 1
            new_exon = exon[1] - 1, exon[1]
            texon = texon[1] - 1, texon[1]
            transcript.logger.debug('Appending monobase CDS exon %s (Texon %s)'
                , new_exon, texon)
        else:
            to_discard = exon[0] + 1, exon[1]
            new_exon = exon[0], exon[0] + 1
            texon = texon[1] - 1, texon[1]
            transcript.logger.debug('Appending monobase CDS exon %s (Texon %s)'
                , new_exon, texon)
    elif texon[0] == boundary[1]:
        if right is False:
            transcript.logger.debug('Appending mixed UTR/CDS right exon %s',
                exon)
        elif transcript.strand == '+':
            to_discard = exon[0] + 1, exon[1]
            new_exon = exon[0], exon[0] + 1
            texon = texon[0], texon[0] + 1
            transcript.logger.debug('Appending monobase CDS exon %s (Texon %s)'
                , new_exon, texon)
        else:
            to_discard = exon[0], exon[1] - 1
            new_exon = exon[1] - 1, exon[1]
            texon = texon[0], texon[0] + 1
            transcript.logger.debug('Appending monobase CDS exon %s (Texon %s)'
                , new_exon, texon)
    elif texon[0] <= boundary[0] <= boundary[1] <= texon[1]:
        transcript.logger.debug('Exon %s, case 3.1', exon)
        if invert is True:
            if left is True:
                new_exon[1] = exon[0] + (texon[1] - boundary[0])
                transcript.logger.debug(
                    'Case 3.1: Negative strand, another transcript on the left, new exon: %d, %d'
                    , new_exon[0], new_exon[1])
            if right is True:
                new_exon[0] = exon[1] - (boundary[1] - texon[0])
                transcript.logger.debug(
                    'Case 3.1: Negative strand, another transcript on the right, new exon: %d, %d'
                    , new_exon[0], new_exon[1])
        else:
            if left is True:
                new_exon[0] = exon[1] - (texon[1] - boundary[0])
                transcript.logger.debug(
                    'Case 3.1: Positive strand, another transcript on the left, new exon: %d, %d'
                    , new_exon[0], new_exon[1])
            if right is True:
                new_exon[1] = exon[0] + (boundary[1] - texon[0])
                transcript.logger.debug(
                    'Case 3.1: Positive strand, another transcript on the right, new exon: %d, %d'
                    , new_exon[0], new_exon[1])
        transcript.logger.debug('[Monoexonic] Tstart shifted for %s, %d to %d',
            transcript.id, texon[0], boundary[0])
        transcript.logger.debug('[Monoexonic] GStart shifted for %s, %d to %d',
            transcript.id, exon[0], new_exon[1])
        transcript.logger.debug('[Monoexonic] Tend shifted for %s, %d to %d',
            transcript.id, texon[1], boundary[1])
        transcript.logger.debug('[Monoexonic] Gend shifted for %s, %d to %d',
            transcript.id, exon[1], new_exon[1])
        if left is True:
            texon[0] = boundary[0]
        if right is True:
            texon[1] = boundary[1]
    elif texon[0] <= boundary[0] <= texon[1] <= boundary[1]:
        if left is True:
            if transcript.strand == '-':
                new_exon[1] = exon[0] + (texon[1] - boundary[0])
            else:
                new_exon[0] = exon[1] - (texon[1] - boundary[0])
            transcript.logger.debug('Tstart shifted for %s, %d to %d',
                transcript.id, texon[0], boundary[0])
            transcript.logger.debug('GStart shifted for %s, %d to %d',
                transcript.id, exon[0], new_exon[1])
            texon[0] = boundary[0]
    elif texon[1] >= boundary[1] >= texon[0] >= boundary[0]:
        if right is True:
            if transcript.strand == '-':
                new_exon[0] = exon[1] - (boundary[1] - texon[0])
            else:
                new_exon[1] = exon[0] + (boundary[1] - texon[0])
            transcript.logger.debug('Tend shifted for %s, %d to %d',
                transcript.id, texon[1], boundary[1])
            transcript.logger.debug('Gend shifted for %s, %d to %d',
                transcript.id, exon[1], new_exon[1])
            texon[1] = boundary[1]
        else:
            transcript.logger.debug('New exon: %s', new_exon)
            transcript.logger.debug('New texon: %s', texon)
    new_exon = tuple([new_exon[0], new_exon[1]])
    return new_exon, texon, to_discard
