<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def walkfiles(startdir, regex=None, recurse=True):
 """Yields the absolute paths of files found within the given start directory. Can optionally filter paths using a regex pattern."""

    for r,_,fs in os.walk(startdir):
        if not recurse and startdir != r:
            return
        for f in fs:
            path = op.abspath(op.join(r,f))
            if regex and not _is_match(regex, path):
                    continue
            if op.isfile(path):
                yield path