def get_fasta_records(fasta, transcripts):
records = {}<EOL>f = pysam.FastaFile(fasta)<EOL>for transcript in transcripts:<EOL><INDENT>try:<EOL><INDENT>sequence, length = f.fetch(transcript), f.get_reference_length(transcript)<EOL><DEDENT>except KeyError:<EOL><INDENT>msg = '<STR_LIT>'.format(transcript)<EOL>log.error(msg)<EOL>raise ArgumentError(msg)<EOL><DEDENT>records[transcript] = {'<STR_LIT>': sequence, '<STR_LIT>': length}<EOL><DEDENT>f.close()<EOL>return records<EOL>
Return list of transcript records from the given fasta file.
    Each record will be of the form {'sequence_id': {'sequence': 'AAA', 'length': 3}}

    trascripts should be provided as a list of sequence id's.