code: def format_datetime(
      value: t.Union[int, float, datetime],
  ) -> str:
      """Format datetime object or timestamp value.
  
      Parameters
      ----------
      value : Union[datetime, int, float]
          datetime (timestamp) to format
      Returns
      -------
      str
          string representation of the provided value
      Raises
      ------
      ValueError
          if unexpected value type was passed to the function
      """
      if isinstance(value, datetime):
          datetime_value = value
      elif isinstance(value, (int, float)):
          datetime_value = datetime.fromtimestamp(value)
      else:
          raise ValueError(
              f"Unsupported value type - {type(value).__name__}"
          )
  
      if (
          datetime_value.hour == 0
          and datetime_value.minute == 0
          and datetime_value.second == 0
      ):
          return datetime_value.strftime("%Y-%m-%d")
      elif (
          datetime_value.hour != 0 or datetime_value.minute != 0
      ) and datetime_value.second == 0:
          return datetime_value.strftime("%Y-%m-%d %H:%M")
      else:
          return datetime_value.strftime("%Y-%m-%d %H:%M:%S")
  
imports: import io
  import itertools
  import json
  import os
  import random
  import re
  import sys
  import typing
  from collections import defaultdict
  from copy import copy
  from datetime import datetime
  from decimal import Decimal
  from string import ascii_uppercase, digits
  import numpy
  import pandas
  from ipywidgets import Widget
  from ipywidgets.embed import dependency_state, embed_data, escape_script, snippet_template, widget_view_template
  from packaging.version import Version
  from pandas.core.dtypes.common import is_numeric_dtype
  import deepchecks
  from deepchecks import core
  from deepchecks.core.resources import jupyterlab_plotly_script, requirejs_script, suite_template, widgets_script
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 21 for calling a global function with example usage: format_datetime(value) and returns: datetime_value, datetime_value, datetime_value