code: def path_segment(self, index, value=None, default=None):
          
          if value is not None:
              segments = list(self.path_segments())
              segments[index] = unicode_quote_path_segment(value)
              new_path = '/' + '/'.join(segments)
              if self._tuple.path.endswith('/'):
                  new_path += '/'
              return URL._mutate(self, path=new_path)
          try:
              return self.path_segments()[index]
          except IndexError:
              return default
docs: Return the path segment at the given index
  
          :param integer index:
          :param string value: the new segment value
          :param string default: the default value to return if no path segment exists with the given index