def reverse_complement(seq):
    """Returns the reverse complement of a DNA sequence as string"""
    compdict = {
        "a": "t",
        "c": "g",
        "g": "c",
        "t": "a",
        "u": "t",
        "m": "k",
        "r": "y",
        "w": "w",
        "s": "s",
        "y": "r",
        "k": "m",
        "v": "b",
        "h": "d",
        "d": "h",
        "b": "v",
        "x": "x",
        "n": "n",
        "A": "T",
        "C": "G",
        "G": "C",
        "T": "A",
        "U": "T",
        "M": "K",
        "R": "Y",
        "W": "W",
        "S": "S",
        "Y": "R",
        "K": "M",
        "V": "B",
        "H": "D",
        "D": "H",
        "B": "V",
        "X": "X",
        "N": "N",
        "*": "*",
    }

    complseq = "".join(compdict[base] for base in seq)
    # python hack to reverse a list/string/etc
    complseq = complseq[::-1]
    return complseq