code: def query(**kwargs):
      
      count = kwargs.get('count', None)
      task_list = _query(**kwargs)
      task_dict_list = [_task_to_dict(task) for task in task_list]
  
      if count == 1:
          if not task_dict_list:
              return None
          else:
              return task_dict_list[0]
  
      return task_dict_list
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:
          Dictionaries of the most recent tasks that match the criteria, in
          order of most recently created. When count is 1 the return value will
          be the most recent task or None. When count is not 1 the return value
          will be a  list of tasks.