def rev_comp(seq):
    """Generate reverse complement of a DNA sequence"""
    final = ''
    d = {'A':'T', 'T':'A', 'C':'G', 'G':'C', 'N':'N'}

    for base in reversed(seq):
        final += d[base]

    return final