def rev_comp(seq: str) -> str:
    """
    Generates the reverse complement of a sequence.
    """
    comp = {
        "A": "T",
        "C": "G",
        "G": "C",
        "T": "A",
        "B": "N",
        "N": "N",
        "R": "N",
        "M": "N",
        "Y": "N",
        "S": "N",
        "W": "N",
        "K": "N",
        "a": "t",
        "c": "g",
        "g": "c",
        "t": "a",
        "n": "n",
        " ": "",
    }

    rev_seq = "".join(comp.get(base, base) for base in reversed(seq))

    return rev_seq