code: def convert_to_datetime(
      datetime_str: Optional[str],
  ) -> Optional[dt.datetime]:
      """Callback to convert string to datetime given as an iso8601 timestamp."""
      if datetime_str is None:
          return None
  
      try:
          return parse(datetime_str)
      except Exception:
          raise click.BadParameter("must be valid iso8601 timestamp")
  
file_path: metricflow/metricflow/cli/utils.py
imports: from __future__ import annotations
  import datetime
  import logging
  import pathlib
  import traceback
  from functools import update_wrapper, wraps
  from typing import Any, Callable, List, Optional
  import click
  from dateutil.parser import parse
  import metricflow.cli.custom_click_types
  from metricflow.cli.cli_context import CLIContext
label_desc: Use image node_id 3 for calling a global function with example usage: convert_to_datetime(datetime_str) and returns: None, parse