def build_tx_cigar(exons, strand):
cigarelem_re = re.compile(r"<STR_LIT>")<EOL>def _reverse_cigar(c):<EOL><INDENT>return '<STR_LIT>'.join(reversed(cigarelem_re.findall(c)))<EOL><DEDENT>if len(exons) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>if strand == -<NUM_LIT:1>:<EOL><INDENT>cigars = [_reverse_cigar(e["<STR_LIT>"]) for e in exons]<EOL><DEDENT>else:<EOL><INDENT>cigars = [e["<STR_LIT>"] for e in exons]<EOL><DEDENT>tx_cigar = [cigars[<NUM_LIT:0>]]    <EOL>for i in range(<NUM_LIT:1>, len(cigars)):    <EOL><INDENT>intron = str(exons[i]["<STR_LIT>"] - exons[i - <NUM_LIT:1>]["<STR_LIT>"]) + "<STR_LIT:N>"<EOL>tx_cigar += [intron, cigars[i]]<EOL><DEDENT>tx_cigar_str = "<STR_LIT>".join(tx_cigar)<EOL>return tx_cigar_str<EOL>
builds a single CIGAR string representing an alignment of the
    transcript sequence to a reference sequence, including introns.
    The input exons are expected to be in transcript order, and the
    resulting CIGAR is also in transcript order. 

    >>> build_tx_cigar([], 1) is None
    True