<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def WhereIs(self, prog, path=None, pathext=None, reject=[]):
 """Find prog in the path. """

        if path is None:
            try:
                path = self['ENV']['PATH']
            except KeyError:
                pass
        elif SCons.Util.is_String(path):
            path = self.subst(path)
        if pathext is None:
            try:
                pathext = self['ENV']['PATHEXT']
            except KeyError:
                pass
        elif SCons.Util.is_String(pathext):
            pathext = self.subst(pathext)
        prog = SCons.Util.CLVar(self.subst(prog)) # support "program --with-args"
        path = SCons.Util.WhereIs(prog[0], path, pathext, reject)
        if path: return path
        return None