code: def add(queue_name, payload=None, content_type=None, source=None, task_id=None,
          build_id=None, release_id=None, run_id=None):
      
      if task_id:
          task = WorkQueue.query.filter_by(task_id=task_id).first()
          if task:
              return task.task_id
      else:
          task_id = uuid.uuid4().hex
  
      if payload and not content_type and not isinstance(payload, basestring):
          payload = json.dumps(payload)
          content_type = 'application/json'
  
      now = datetime.datetime.utcnow()
      task = WorkQueue(
          task_id=task_id,
          queue_name=queue_name,
          eta=now,
          source=source,
          build_id=build_id,
          release_id=release_id,
          run_id=run_id,
          payload=payload,
          content_type=content_type)
      db.session.add(task)
  
      return task.task_id
docs: Adds a work item to a queue.
  
      Args:
          queue_name: Name of the queue to add the work item to.
          payload: Optional. Payload that describes the work to do as a string.
              If not a string and content_type is not provided, then this
              function assumes the payload is a JSON-able Python object.
          content_type: Optional. Content type of the payload.
          source: Optional. Who or what originally created the task.
          task_id: Optional. When supplied, only enqueue this task if a task
              with this ID does not already exist. If a task with this ID already
              exists, then this function will do nothing.
          build_id: Build ID to associate with this task. May be None.
          release_id: Release ID to associate with this task. May be None.
          run_id: Run ID to associate with this task. May be None.
  
      Returns:
          ID of the task that was added.