code: def collection_location(obj):
      
      # TODO kind is not part of IObjectLoader and we should really be loading
      # apiVersion off of this object too.
      kind = obj.kind
      apiVersion = obj.apiVersion
  
      prefix = version_to_segments[apiVersion]
  
      collection = kind.lower() + u"s"
  
      if IObject.providedBy(obj):
          # Actual objects *could* have a namespace...
          namespace = obj.metadata.namespace
      else:
          # Types representing a kind couldn't possible.
          namespace = None
  
      if namespace is None:
          # If there's no namespace, look in the un-namespaced area.
          return prefix + (collection,)
  
      # If there is, great, look there.
      return prefix + (u"namespaces", namespace, collection)
docs: Get the URL for the collection of objects like ``obj``.
  
      :param obj: Either a type representing a Kubernetes object kind or an
          instance of such a type.
  
      :return tuple[unicode]: Some path segments to stick on to a base URL to
          construct the location of the collection of objects like the one
          given.