def get_sequence_lengths(pj):
    
    """
    Return a dictionary with locus names as keys and lists of sequence length as values
    given a Project instance.
    
    The length are calculated from the unaligned and untrimmed sequences
    """
    
    if len(pj.records) == 0:
            raise IOError('No records in the Project')
    
    lengths = {}

    
    if len(pj.records_by_locus) == 0:
        pj.extract_by_locus()
    
    for locus in pj.records_by_locus:
        lengths[locus] = []
        for r in pj.records_by_locus[locus]:
            lengths[locus].append(len(r.seq))
    return lengths