<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def resolve_file_path_list(pathlist, workdir, prefix='', randomize=False):
 """Resolve the path of each file name in the file ``pathlist`` and write the updated paths to a new file. """

    files = []
    with open(pathlist, 'r') as f:
        files = [line.strip() for line in f]

    newfiles = []
    for f in files:
        f = os.path.expandvars(f)
        if os.path.isfile(f):
            newfiles += [f]
        else:
            newfiles += [os.path.join(workdir, f)]

    if randomize:
        _, tmppath = tempfile.mkstemp(prefix=prefix, dir=workdir)
    else:
        tmppath = os.path.join(workdir, prefix)

    tmppath += '.txt'

    with open(tmppath, 'w') as tmpfile:
        tmpfile.write("\n".join(newfiles))
    return tmppath