code: def _query(queue_name=None, build_id=None, release_id=None, run_id=None,
             count=None):
      
      assert queue_name or build_id or release_id or run_id
  
      q = WorkQueue.query
      if queue_name:
          q = q.filter_by(queue_name=queue_name)
      if build_id:
          q = q.filter_by(build_id=build_id)
      if release_id:
          q = q.filter_by(release_id=release_id)
      if run_id:
          q = q.filter_by(run_id=run_id)
  
      q = q.order_by(WorkQueue.created.desc())
  
      if count is not None:
          q = q.limit(count)
  
      return q.all()
docs: Queries for work items based on their criteria.
  
      Args:
          queue_name: Optional queue name to restrict to.
          build_id: Optional build ID to restrict to.
          release_id: Optional release ID to restrict to.
          run_id: Optional run ID to restrict to.
          count: How many tasks to fetch. Defaults to None, which means all
              tasks are fetch that match the query.
  
      Returns:
          List of WorkQueue items.