code: def format_date_freq(freq: Optional[str] = None) -> str:
      """
      Args:
          freq (Optional[str]): Time series frequency (follow's Panda's convention).
  
      Returns:
          str: Ideal datetime format string based on the frequency.
      """
      dt_fmt_default = "%Y-%m-%d %H:%M:%S"
      dt_fmt_dic = {
          "A": "%Y",
          "Q": "%Y-%m",
          "M": "%Y-%m",
          "W": "%Y-%m-%d (w%W)",
          "D": "%Y-%m-%d",
          "B": "%Y-%m-%d",
          "H": "%Y-%m-%d %H:%M",
      }
      freq = freq[0] if freq else ""
      fmt = dt_fmt_dic.get(freq, dt_fmt_default)
      return "{:" + fmt + "}"
  
file_path: tslumen/tslumen/jinja_utils.py
imports: from math import ceil, log10, floor
  from typing import List, Optional, Any, Tuple
  from datetime import datetime
  import re
  import numpy
  import pandas
  import jinja2
label_desc: Use image node_id 1 for calling a global function with example usage: format_date_freq(freq) and returns: unknown