code: def search_file(search_root, search_filename,
                      instance_relative_root=False):
          
          if instance_relative_root:
              search_root = os.path.join(current_app.instance_path, search_root)
          file_path = None
          file_ext = None
          for file in os.listdir(search_root):
              filename, ext = os.path.splitext(file)
              if filename == search_filename and ext and ext != '.':
                  file_path = os.path.join(search_root, filename + ext)
                  file_ext = ext[1:]  # remove heading '.' (dot)
                  break
          return file_path, file_ext
docs: Search for a filename in a specific search root dir.
  
          :param search_root: root dir to search
          :param search_filename: filename to search (no extension)
          :param instance_relative_root: search root is relative to instance path
          :return: tuple(full_file_path, extension without heading dot)