code: def wrap_queries_in_bool_clauses_if_more_than_one(queries,
                                                    use_must_clause,
                                                    preserve_bool_semantics_if_one_clause=False):
      
      if not queries:
          return {}
  
      if len(queries) == 1 and not preserve_bool_semantics_if_one_clause:
          return queries[0]
  
      return {
          'bool': {
              ('must' if use_must_clause else 'should'): queries
          }
      }
docs: Helper for wrapping a list of queries into a bool.{must, should} clause.
  
      Args:
          queries (list): List of queries to be wrapped in a bool.{must, should} clause.
          use_must_clause (bool): Flag that signifies whether to use 'must' or 'should' clause.
          preserve_bool_semantics_if_one_clause (bool): Flag that signifies whether to generate a bool query even if
              there's only one clause. This happens to generate boolean query semantics. Usually not the case, but
              useful for boolean queries support.
  
      Returns:
          (dict): If len(queries) > 1, the bool clause, otherwise if len(queries) == 1, will return the query itself,
                  while finally, if len(queries) == 0, then an empty dictionary is returned.