code: def walkfiles(startdir, regex=None, recurse=True):
      
      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
docs: Yields the absolute paths of files found within the given start
      directory. Can optionally filter paths using a regex pattern.