code: def search(query, catalog=_marker):
      
  
      # query needs to be a dictionary
      if not isinstance(query, dict):
          fail("Catalog query needs to be a dictionary")
  
      # Portal types to query
      portal_types = query.get("portal_type", [])
      # We want the portal_type as a list
      if not isinstance(portal_types, (tuple, list)):
          portal_types = [portal_types]
  
      # The catalogs used for the query
      catalogs = []
  
      # The user did **not** specify a catalog
      if catalog is _marker:
          # Find the registered catalogs for the queried portal types
          for portal_type in portal_types:
              # Just get the first registered/default catalog
              catalogs.append(get_catalogs_for(
                  portal_type, default="portal_catalog")[0])
      else:
          # User defined catalogs
          if isinstance(catalog, (list, tuple)):
              catalogs.extend(map(get_tool, catalog))
          else:
              catalogs.append(get_tool(catalog))
  
      # Cleanup: Avoid duplicate catalogs
      catalogs = list(set(catalogs)) or [get_portal_catalog()]
  
      # We only support **single** catalog queries
      if len(catalogs) > 1:
          fail("Multi Catalog Queries are not supported!")
  
      return catalogs[0](query)
docs: Search for objects.
  
      :param query: A suitable search query.
      :type query: dict
      :param catalog: A single catalog id or a list of catalog ids
      :type catalog: str/list
      :returns: Search results
      :rtype: List of ZCatalog brains