code: def _reshape_youtube_url(url: str) -> Optional[str]:
      """Return whether URL is any kind of YouTube embed or watch link.  If so,
      reshape URL into an embed link suitable for use in an iframe.
  
      If not a YouTube URL, return None.
  
      Parameters
      ----------
          url : str
  
      Example
      -------
      >>> print(_reshape_youtube_url('https://youtu.be/_T8LGqJtuGc'))
  
      .. output::
          https://www.youtube.com/embed/_T8LGqJtuGc
      """
      match = YOUTUBE_RE.match(url)
      if match:
          return "https://www.youtube.com/embed/{code}".format(
              **match.groupdict()
          )
      return None
  
imports: import io
  import re
  from typing import TYPE_CHECKING, Optional, Tuple, Union, cast
  from typing_extensions import Final, TypeAlias
  import streamlit
  from streamlit import runtime, type_util
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Audio_pb2 import Audio
  from streamlit.proto.Video_pb2 import Video
  from streamlit.runtime import caching
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 1 for calling a global function with example usage: _reshape_youtube_url(url) and returns: None, str