code: def url_to_filename(url):
      
      # remove leading/trailing slash
      if url.startswith('/'):
          url = url[1:]
      if url.endswith('/'):
          url = url[:-1]
      # remove pardir symbols to prevent unwilling filesystem access
      url = remove_pardir_symbols(url)
      # replace dots to underscore in filename part
      url = replace_dots_to_underscores_at_last(url)
      return url
docs: Safely translate url to relative filename
  
      Args:
          url (str): A target url string
  
      Returns:
          str