code: def recursive_mtime(path, newest=True):
      
      if os.path.isfile(path):
          return mtime(path)
      current_extreme = None
      for dirname, _, filenames in os.walk(path, topdown=False):
          for filename in filenames:
              mt = mtime(os.path.join(dirname, filename))
              if newest:  # Put outside of loop?
                  if mt >= (current_extreme or mt):
                      current_extreme = mt
              elif mt <= (current_extreme or mt):
                  current_extreme = mt
      return current_extreme
docs: Gets the newest/oldest mtime for all files in a directory.