input: Write a function to create a Flask-based web API that returns the current date and time in the format "YYYY-MM-DD HH:MM:SS" when accessed at the '/datetime' endpoint. The function should initialize a Flask app and a route to handle the request. When the endpoint is accessed, it should return the current date and time.
  
  assert get_datetime()=='2023-10-10 14:30:00'
  assert get_datetime()=='2023-11-15 09:45:30'
  assert get_datetime()=='2024-01-01 00:00:00'
output: from flask import Flask
  from datetime import datetime
  
  def get_datetime():
      app = Flask(__name__)
  
      @app.route('/datetime')
      def datetime_endpoint():
          now = datetime.now()
          return now.strftime("%Y-%m-%d %H:%M:%S")
  
      app.run()