def cleanRepl(matchobj):
    """
        Clean up a directory name so that it can be written to a
        matplotlib title without encountering LaTeX escape sequences
        Replace backslashes with forward slashes
        replace underscores (subscript) with escaped underscores
    """
    if matchobj.group(0) == r'\\':
        return '/'
    if matchobj.group(0) == r'_':
        return r'\_'
    if matchobj.group(0) == r'/':
        return '/'
    else:
        return ''