input: Write a function to implement a basic CRUD API for the BlogPost model using Python/Flask. The API should include endpoints for creating a post, getting all posts, getting a single post, editing a post, and deleting a post. If successful, return the ID of the post or a confirmation message; otherwise, return an error message.
  assert create_post({'title': 'Test Post', 'content': 'This is a test.'})==<expected_post_id>
  assert get_posts()==[<expected_post_details>]
  assert get_post(<expected_post_id>)==<expected_post_details>
  assert edit_post(<expected_post_id>, {'title': 'Updated Post', 'content': 'This post has been updated.'})==<expected_updated_post_details>
  assert delete_post(<expected_post_id>)=={'message': 'Post deleted'}
output: def create_post(post_data):
      new_post = BlogPost(**post_data)
      db.session.add(new_post)
      db.session.commit()
      return new_post.id
  
  def get_posts():
      posts = BlogPost.query.all()
      return [post.serialize() for post in posts]
  
  def get_post(post_id):
      post = BlogPost.query.get(post_id)
      if post:
          return post.serialize()
      return {'error': 'Post not found'}
  
  def edit_post(post_id, updated_data):
      post = BlogPost.query.get(post_id)
      if post:
          for key, value in updated_data.items():
              setattr(post, key, value)
          db.session.commit()
          return post.serialize()
      return {'error': 'Post not found'}
  
  def delete_post(post_id):
      post = BlogPost.query.get(post_id)
      if post:
          db.session.delete(post)
          db.session.commit()
          return {'message': 'Post deleted'}
      return {'error': 'Post not found'}