old_contents: import time
  from datetime import datetime
  
  from celery import Celery
  
  
  app = Celery("tasks", broker="amqp://", backend="amqp")
  
  
  @app.task
  def add(x, y):
      return x + y
  
  
  @app.task
  def sleep(seconds):
      time.sleep(seconds)
  
  
  @app.task
  def echo(msg, timestamp=False):
      return "%s: %s" % (datetime.now(), msg) if timestamp else msg
  
  
  @app.task
  def error(msg):
      raise Exception(msg)
  
  
  if __name__ == "__main__":
      app.start()
  
new_contents: import time
  from datetime import datetime
  
  from celery import Celery
  
  
  app = Celery("tasks", broker="amqp://", backend="amqp")
  app.conf.CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
  
  
  @app.task
  def add(x, y):
      return x + y
  
  
  @app.task
  def sleep(seconds):
      time.sleep(seconds)
  
  
  @app.task
  def echo(msg, timestamp=False):
      return "%s: %s" % (datetime.now(), msg) if timestamp else msg
  
  
  @app.task
  def error(msg):
      raise Exception(msg)
  
  
  if __name__ == "__main__":
      app.start()
  
subject: Define CELERY_ACCEPT_CONTENT for examples