def Comp(sequence):
    """ complements a sequence, preserving case."""
    d={'A':'T','T':'A','C':'G','G':'C','a':'t','t':'a','c':'g','g':'c','N':'N','n':'n'}
    cSeq=''
    for s in sequence:
        cSeq+=d[s]
    return cSeq