input: Write a python function to format a string by replacing single white space with a comma, multiple white spaces with a single white space, and removing leading and trailing white spaces using regular expressions.
  assert format_data('a   b  c   d') == 'a,b,c,d'
  assert format_data('   hello   world  ') == 'hello,world'
  assert format_data('  multiple    spaces   here ') == 'multiple,spaces,here'
output: def format_data(s: str) -> str:
      import re
      s = re.sub(r'\s+', ' ', s)  # Replace multiple whitespaces with a single space
      s = s.strip()               # Remove leading and trailing whitespaces
      s = s.replace(' ', ',')     # Replace single spaces with a comma
      return s