code: def url_to_https(url) -> str | None:
      # Ensure URL exists
      if not url:
          return None
  
      base_url = None
      if url.startswith("git@"):
          part = url.split("git@")[1:2]
          if part:
              base_url = f'https://{part[0].replace(":", "/", 1)}'
      elif url.startswith("https://"):
          base_url = url
  
      if not base_url:
          raise ValueError(f"Unable to extract location from: {url}")
  
      if base_url.endswith(".git"):
          base_url = base_url[:-4]
      return base_url
  
imports: from __future__ import annotations
  import datetime
  import json
  import logging
  import os
  from contextlib import suppress
  from functools import wraps
  from typing import TYPE_CHECKING, Any, Iterable
  from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
  import attrs
  from attrs import asdict
  from openlineage.client.utils import RedactMixin
  from airflow.compat.functools import cache
  from airflow.configuration import conf
  from airflow.providers.openlineage.plugins.facets import AirflowMappedTaskRunFacet, AirflowRunFacet
  from airflow.utils.context import AirflowContextDeprecationWarning
  from airflow.utils.log.secrets_masker import Redactable, Redacted, SecretsMasker, should_hide_value_for_key
label_desc: Use image node_id 4 for calling a global function with example usage: url_to_https(url) and returns: base_url, None