import tempfile


def _scrub_traceback_entry(code_name, entry):
    """Given the name of some code (e.g. "~ your sequence code ~") and
    an entry from the trace list, scrubs any references to the names of
    the files that contain the user code and replaces them with code_name.
    """
    # The filenames in the trace will point to either Simulation/Vespa
    # files or the user's pulse seq code. The latter is saved to the temp dir,
    # so if the temp dir is present in the filename, it must refer to the
    # user's code.
    if tempfile.gettempdir() in entry[0]:
        entry = tuple([code_name] + list(entry[1:]))

    return entry