code: def fix_page_relative_url(rel_url):
          
          rel_url = rel_url.lstrip('/')  # trim all heading '/'
          endswith_slash = rel_url.endswith('/')
          rel_url = rel_url.rstrip('/') + (
              '/' if endswith_slash else '')  # preserve only one trailing '/'
          if not rel_url or rel_url == '/':
              return None, False
  
          file_path = os.path.join(current_app.instance_path, 'pages',
                                   rel_url.replace('/', os.path.sep))
          if rel_url.endswith('/'):
              index_html_file_path = os.path.join(file_path, 'index.html')
              if os.path.isfile(index_html_file_path):
                  # index.html exists
                  return index_html_file_path, True
              return rel_url, False
          elif os.path.isfile(file_path):
              ext = os.path.splitext(file_path)[1][1:]
              if get_standard_format_name(ext) is not None:
                  # is source of custom page
                  if current_app.config['PAGE_SOURCE_ACCESSIBLE']:
                      return file_path, True
              else:
                  # is other direct files
                  return file_path, True
          elif os.path.isdir(file_path):
              return rel_url + '/', False
  
          sp = rel_url.rsplit('/', 1)
          m = re.match(r'(.+)\.html?', sp[-1])
          if m:
              sp[-1] = m.group(1) + '.html'
          else:
              sp[-1] += '.html'
          return '/'.join(sp), False
docs: Fix page relative url to a standard, uniform format.
  
          Possible input:
          - my-page
          - my-page/
          - my-page/index
          - my-page/index.htm
          - my-page/index.html
          - my-page/specific.file
  
          :param rel_url: relative url to fix
          :return: tuple(fixed relative url or FILE PATH if exists else None,
                         file exists or not)