def normalize_repr(v):
    """
    Return dictionary repr sorted by keys, leave others unchanged

    >>> normalize_repr({1:2,3:4,5:6,7:8})
    '{1: 2, 3: 4, 5: 6, 7: 8}'
    >>> normalize_repr('foo')
    "'foo'"
    """
    if isinstance(v, dict):
        items = [(repr(k), repr(v)) for k, v in list(v.items())]
        items.sort()
        return "{" + ", ".join([
            "%s: %s" % itm for itm in items]) + "}"

    return repr(v)