import re


def prettify_keys(string):
    """Utility function used to clean keys with numerical values, so that
       they can be ordered alphabetically the way they should be."""
    r = re.compile("bandwidth_([0-9]{1,3})")
    def replacer(match):
        m = match.groups()[0]
        return "bandwidth " + m
    return r.sub(replacer, string)