def _set_pfiles(dry_run, **kwargs):
    """Set the PFILES env var
    
    Parameters
    ----------

    dry_run : bool
        Don't actually run

    Keyword arguments
    -----------------

    pfiles : str
        Value to set PFILES

    Returns
    -------

    pfiles_orig : str
        Current value of PFILES envar
    """
    pfiles_orig = os.environ['PFILES']
    pfiles = kwargs.get('pfiles', None)
    if pfiles:
        if dry_run:
            print("mkdir %s" % pfiles)
        else:
            try:
                os.makedirs(pfiles)
            except OSError:
                pass
        pfiles = "%s:%s" % (pfiles, pfiles_orig)
        os.environ['PFILES'] = pfiles
    return pfiles_orig