import re


def clean_topo(topo):
    """Cleans topology string by removing odd/unnecessary characters

    Also validates topostring to make confirm that we know what we are working with
    """
    topo = re.sub('\s+', '', topo)

    if topo.startswith("***No"):
        return ""

    topo = topo.replace('L', '-').replace('u', '-')

    if not set(list(topo)).issubset(['S', 'i', 'o', 'M', '-']):
        raise ValueError("Unexpected character in topostring: " + topo)

    return topo