code: def resource_to_portal_type(resource):
      
      if resource is None:
          return None
  
      resource_mapping = get_resource_mapping()
      portal_type = resource_mapping.get(resource.lower())
  
      if portal_type is None:
          logger.warn("Could not map the resource '{}' "
                      "to any known portal type".format(resource))
  
      return portal_type
docs: Converts a resource to a portal type
  
      :param resource: Resource name as it is used in the content route
      :type name: string
      :returns: Portal type name
      :rtype: string