<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_file_is_under_workingdir(filename, wdir):
 """ Raise error if input is being staged to a location not underneath the working dir """

        p = filename
        if not os.path.isabs(p):
            p = os.path.join(wdir, p)
        targetpath = os.path.realpath(p)
        wdir = os.path.realpath(wdir)
        common = os.path.commonprefix([wdir, targetpath])
        if len(common) < len(wdir):
            raise exceptions.PathError(
                    "The subprocess engine does not support input files with absolute paths")
        return p