import hashlib


def sequence_to_md5(sequence):
    """
    Converts a sequence to an md5 hash after replacing Us with
    Ts

    sequence: A valid RNA/DNA sequence

    return: MD5 hash of the sequence
    """

    md5_converter = hashlib.md5()
    # convert to DNA
    sequence = sequence.replace('U', 'T')
    md5_converter.update(sequence.encode('utf-8'))
    sequence_md5 = md5_converter.hexdigest()

    return sequence_md5