def [](namespace_or_namespace_and_predicate, predicate = nil)
      case namespace_or_namespace_and_predicate
      when Regexp
        tags = @machine_tags.select do |machine_tag|
          machine_tag.namespace =~ namespace_or_namespace_and_predicate ||
            machine_tag.namespace_and_predicate =~ namespace_or_namespace_and_predicate
        end

        case predicate
        when nil
        when Regexp
          tags.select! { |machine_tag| machine_tag.predicate =~ predicate }
        else
          raise ArgumentError, "Invalid machine tag predicate: #{predicate.inspect}" unless predicate =~ /^#{PREFIX}$/
          tags.select! { |machine_tag| machine_tag.predicate == predicate }
        end

        ::Set.new tags
      else
        if namespace_or_namespace_and_predicate =~ /^#{PREFIX}$/
          namespace = namespace_or_namespace_and_predicate

          unless predicate
            @tags_by_namespace[namespace] || Set[]
          else
            case predicate
            when Regexp
              ::Set.new @tags_by_namespace[namespace].select { |machine_tag| machine_tag.predicate =~ predicate }
            else
              raise ArgumentError, "Invalid machine tag predicate: #{predicate.inspect}" unless predicate =~ /^#{PREFIX}$/
              @tags_by_namespace_and_predicate["#{namespace}:#{predicate}"] || Set[]
            end
          end
        elsif namespace_or_namespace_and_predicate =~ /^#{NAMESPACE_AND_PREDICATE}$/
          namespace_and_predicate = namespace_or_namespace_and_predicate
          raise ArgumentError, "Separate predicate passed with namespace and predicate: #{namespace_and_predicate.inspect}, #{predicate.inspect}" if predicate
          @tags_by_namespace_and_predicate[namespace_and_predicate] || Set[]
        else
          raise ArgumentError, "Invalid machine tag namespace and/or predicate: #{namespace_or_namespace_and_predicate.inspect}, #{predicate.inspect}"
        end
      end
    end
def [](namespace_or_namespace_and_predicate, predicate = nil)
      case namespace_or_namespace_and_predicate
      when Regexp
        tags = @machine_tags.select do |machine_tag|
          machine_tag.namespace =~ namespace_or_namespace_and_predicate ||
            machine_tag.namespace_and_predicate =~ namespace_or_namespace_and_predicate
        end

        case predicate
        when nil
        when Regexp
          tags.select! { |machine_tag| machine_tag.predicate =~ predicate }
        else
          raise ArgumentError, "Invalid machine tag predicate: #{predicate.inspect}" unless predicate =~ /^#{PREFIX}$/
          tags.select! { |machine_tag| machine_tag.predicate == predicate }
        end

        ::Set.new tags
      else
        if namespace_or_namespace_and_predicate =~ /^#{PREFIX}$/
          namespace = namespace_or_namespace_and_predicate

          unless predicate
            @tags_by_namespace[namespace] || Set[]
          else
            case predicate
            when Regexp
              ::Set.new @tags_by_namespace[namespace].select { |machine_tag| machine_tag.predicate =~ predicate }
            else
              raise ArgumentError, "Invalid machine tag predicate: #{predicate.inspect}" unless predicate =~ /^#{PREFIX}$/
              @tags_by_namespace_and_predicate["#{namespace}:#{predicate}"] || Set[]
            end
          end
        elsif namespace_or_namespace_and_predicate =~ /^#{NAMESPACE_AND_PREDICATE}$/
          namespace_and_predicate = namespace_or_namespace_and_predicate
          raise ArgumentError, "Separate predicate passed with namespace and predicate: #{namespace_and_predicate.inspect}, #{predicate.inspect}" if predicate
          @tags_by_namespace_and_predicate[namespace_and_predicate] || Set[]
        else
          raise ArgumentError, "Invalid machine tag namespace and/or predicate: #{namespace_or_namespace_and_predicate.inspect}, #{predicate.inspect}"
        end
      end
    end
Retrieves machine tags in the Set with a matching namespace or namespace and predicate.

 @example
   tags = MachineTag::Set['a:b=x', 'a:b=y', 'a:c=z']
   tags['a']           # => #<Set: {"a:b=x", "a:b=y", "a:c=z"}>
   tags['a', 'b']      # => #<Set: {"a:b=x", "a:b=y"}>
   tags['a:c']         # => #<Set: {"a:c=z"}>
   tags['a', /^[bc]$/] # => #<Set: {"a:b=x", "a:b=y", "a:c=z"}>
   tags[/^a:[bc]$/]    # => #<Set: {"a:b=x", "a:b=y", "a:c=z"}>

 @param namespace_or_namespace_and_predicate [String, Regexp] the namespace to retrieve or the namespace
   and predicate to retreive combined in a string separated by +':'+
 @param predicate [String, Regexp, nil] the predicate to retreive

 @return [::Set<Tag>] the machines tags that have the given namespace or namespace and predicate