def type(name)
    # Avoid loading if name obviously is not a type name
    if name.to_s.include?(':')
      return nil
    end

    @types ||= {}

    # We are overwhelmingly symbols here, which usually match, so it is worth
    # having this special-case to return quickly.  Like, 25K symbols vs. 300
    # strings in this method. --daniel 2012-07-17
    return @types[name] if @types.include? name

    # Try mangling the name, if it is a string.
    if name.is_a? String
      name = name.downcase.intern
      return @types[name] if @types.include? name
    end
    # Try loading the type.
    if typeloader.load(name, Puppet.lookup(:current_environment))
      #TRANSLATORS 'puppet/type/%{name}' should not be translated
      Puppet.warning(_("Loaded puppet/type/%{name} but no class was created") % { name: name }) unless @types.include? name
    elsif !Puppet[:always_retry_plugins]
      # PUP-5482 - Only look for a type once if plugin retry is disabled
      @types[name] = nil
    end

    # ...and I guess that is that, eh.
    return @types[name]
  end
def type(name)
    # Avoid loading if name obviously is not a type name
    if name.to_s.include?(':')
      return nil
    end

    @types ||= {}

    # We are overwhelmingly symbols here, which usually match, so it is worth
    # having this special-case to return quickly.  Like, 25K symbols vs. 300
    # strings in this method. --daniel 2012-07-17
    return @types[name] if @types.include? name

    # Try mangling the name, if it is a string.
    if name.is_a? String
      name = name.downcase.intern
      return @types[name] if @types.include? name
    end
    # Try loading the type.
    if typeloader.load(name, Puppet.lookup(:current_environment))
      #TRANSLATORS 'puppet/type/%{name}' should not be translated
      Puppet.warning(_("Loaded puppet/type/%{name} but no class was created") % { name: name }) unless @types.include? name
    elsif !Puppet[:always_retry_plugins]
      # PUP-5482 - Only look for a type once if plugin retry is disabled
      @types[name] = nil
    end

    # ...and I guess that is that, eh.
    return @types[name]
  end
Returns a Type instance by name.
 This will load the type if not already defined.
 @param [String, Symbol] name of the wanted Type
 @return [Puppet::Type, nil] the type or nil if the type was not defined and could not be loaded