code: def ds_format(ds: str, input_format: str, output_format: str) -> str:
      """
      Output datetime string in a given format.
  
      :param ds: input string which contains a date
      :param input_format: input string format. E.g. %Y-%m-%d
      :param output_format: output string format  E.g. %Y-%m-%d
  
      >>> ds_format("2015-01-01", "%Y-%m-%d", "%m-%d-%y")
      '01-01-15'
      >>> ds_format("1/5/2015", "%m/%d/%Y", "%Y-%m-%d")
      '2015-01-05'
      """
      return datetime.strptime(str(ds), input_format).strftime(
          output_format
      )
  
file_path: airflow/airflow/macros/__init__.py
imports: from __future__ import annotations
  import json
  import time
  import uuid
  from datetime import datetime, timedelta
  from random import random
  from typing import TYPE_CHECKING, Any
  import dateutil
  import airflow.utils.yaml
  from airflow.utils.deprecation_tools import add_deprecated_classes
label_desc: Use image node_id 2 for calling a global function with example usage: ds_format(ds, input_format, output_format) and returns: datetime