code: def build_url(resource, id="", route=""):
      """
      Create a url for a request on a V2 resource.
  
      :param (str) resource: E.g., 'files', 'plots', 'grids', etc.
      :param (str) id: The unique identifier for the resource.
      :param (str) route: Detail/list route. E.g., 'restore', 'lookup', etc.
      :return: (str) The url.
  
      """
      base = config.get_config()["plotly_api_domain"]
      formatter = {
          "base": base,
          "resource": resource,
          "id": id,
          "route": route,
      }
  
      # Add path to base url depending on the input params. Note that `route`
      # can refer to a 'list' or a 'detail' route. Since it cannot refer to
      # both at the same time, it's overloaded in this function.
      if id:
          if route:
              url = "{base}/v2/{resource}/{id}/{route}".format(
                  **formatter
              )
          else:
              url = "{base}/v2/{resource}/{id}".format(**formatter)
      else:
          if route:
              url = "{base}/v2/{resource}/{route}".format(**formatter)
          else:
              url = "{base}/v2/{resource}".format(**formatter)
  
      return url
  
file_path: plotly.py/packages/python/chart-studio/chart_studio/api/v2/utils.py
imports: from __future__ import absolute_import
  import requests
  import json
  from requests.exceptions import RequestException
  from retrying import retry
  import _plotly_utils.exceptions
  from chart_studio import config, exceptions
  from chart_studio.api.utils import basic_auth
  from _plotly_utils.utils import PlotlyJSONEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: build_url(resource, id, route) and returns: url