import re


def countBasesInFasta(fastaFile):
    """
    Given a fasta file, return a dict where the number of records and
    the total number of bases are given by 'records' and 'bases' respectively.
    """
    recordRE = re.compile(r'^>')
    whiteSpaceRE = re.compile(r'\s+')
    total_bases = 0
    total_seqs = 0
    with open(fastaFile) as f:
        for line in f:
            if recordRE.match(line):
                total_seqs += 1
                continue
            total_bases += len(whiteSpaceRE.sub('', line))

    return {'records': total_seqs, 'bases': total_bases}