import re


def prettify_name(name):
    """Prettifies a variable or file name.

    Hyphens and underscores are replaced with spaces and all lowercase tokens
    are title-cased.
    """
    toks = re.sub(r'[-_]+', ' ', name, re.I).split()
    return ' '.join(t.title() if t.islower() else t for t in toks)