code: def _get_embed_url(file_owner_or_url, file_id=None):
      plotly_rest_url = (
          session.get_session_config().get("plotly_domain")
          or get_config_file()["plotly_domain"]
      )
      if file_id is None:  # assume we're using a url
          url = file_owner_or_url
          if url[: len(plotly_rest_url)] != plotly_rest_url:
              raise _plotly_utils.exceptions.PlotlyError(
                  "Because you didn't supply a 'file_id' in the call, "
                  "we're assuming you're trying to snag a figure from a url. "
                  "You supplied the url, '{0}', we expected it to start with "
                  "'{1}'."
                  "\nRun help on this function for more information."
                  "".format(url, plotly_rest_url)
              )
          urlsplit = urllib.parse.urlparse(url)
          file_owner = urlsplit.path.split("/")[1].split("~")[1]
          file_id = urlsplit.path.split("/")[2]
  
          # to check for share_key we check urlsplit.query
          query_dict = urllib.parse.parse_qs(urlsplit.query)
          if query_dict:
              share_key = query_dict["share_key"][-1]
          else:
              share_key = ""
      else:
          file_owner = file_owner_or_url
          share_key = ""
      try:
          test_if_int = int(file_id)
      except ValueError:
          raise _plotly_utils.exceptions.PlotlyError(
              "The 'file_id' argument was not able to be converted into an "
              "integer number. Make sure that the positional 'file_id' argument "
              "is a number that can be converted into an integer or a string "
              "that can be converted into an integer."
          )
      if int(file_id) < 0:
          raise _plotly_utils.exceptions.PlotlyError(
              "The 'file_id' argument must be a non-negative number."
          )
  
      if share_key is "":
          return (
              "{plotly_rest_url}/~{file_owner}/{file_id}.embed".format(
                  plotly_rest_url=plotly_rest_url,
                  file_owner=file_owner,
                  file_id=file_id,
              )
          )
      else:
          return (
              "{plotly_rest_url}/~{file_owner}/"
              "{file_id}.embed?share_key={share_key}"
          ).format(
              plotly_rest_url=plotly_rest_url,
              file_owner=file_owner,
              file_id=file_id,
              share_key=share_key,
          )
  
imports: from __future__ import absolute_import
  import urllib
  import warnings
  import copy
  from _plotly_utils import optional_imports
  import _plotly_utils.exceptions
  from _plotly_utils.files import ensure_writable_plotly_dir
  from chart_studio import session, utils
  from chart_studio.files import CONFIG_FILE, CREDENTIALS_FILE, FILE_CONTENT
label_desc: Use image node_id 9 for calling a global function with example usage: _get_embed_url(file_owner_or_url, file_id) and returns: str, str