  def list_dir_sorted_by_ctime(dir):
      """
      Return a list of files sorted by creation time
      """
      filepaths = [os.path.join(dir, file) for file in os.listdir(dir) if not file.startswith('.')]
      return [item[0] for item in sorted( [(path, os.path.getctime(path)) for path in filepaths],
                                          key=operator.itemgetter(1), reverse=False) ]
  
  def remove_oldest_files(dir, max_files):
      """
      Remove the oldest files in a directory 'dir', leaving at most 'max_files' remaining.
      We use this to limit the number of resources in the sandbox.
 
</s> remove         filepaths = [os.path.join(OBJECT_STORE_DIR, file) for file in os.listdir(OBJECT_STORE_DIR) if not file.startswith('.')]
 </s> add         filepaths = [os.path.join(OBJECT_STORE_DIR, file)
                     for file in os.listdir(OBJECT_STORE_DIR)
                     if not file.startswith('.')] </s> remove         return [reverse('stored-object', request, kwargs={'key':key}) for key in ctime_sorted_basenames]
 </s> add         return [get_file_url(key, request) for key in ctime_sorted_basenames] </s> remove         return {"Some other resources": [reverse('another-example', request, kwargs={'num':num}) for num in range(3)]}
 </s> add         return {"Some other resources": [reverse('another-example', kwargs={'num':num}, request=request) for num in range(3)]} </s> remove         Return a stored object, by unpickling the contents of a locally stored file.
 </s> add         Return a stored object, by unpickling the contents of a locally
        stored file.
    filepaths = [os.path.join(dir, file)
                 for file in os.listdir(dir)
                 if not file.startswith('.')]
    ctimes = [(path, os.path.getctime(path)) for path in filepaths]
    ctimes = sorted(ctimes, key=operator.itemgetter(1), reverse=False)
    return [filepath for filepath, ctime in  ctimes]

  def list_dir_sorted_by_ctime(dir):
      """
      Return a list of files sorted by creation time
      """
    filepaths = [os.path.join(dir, file)
                 for file in os.listdir(dir)
                 if not file.startswith('.')]
    ctimes = [(path, os.path.getctime(path)) for path in filepaths]
    ctimes = sorted(ctimes, key=operator.itemgetter(1), reverse=False)
    return [filepath for filepath, ctime in  ctimes]

    filepaths = [os.path.join(dir, file)
                 for file in os.listdir(dir)
                 if not file.startswith('.')]
    ctimes = [(path, os.path.getctime(path)) for path in filepaths]
    ctimes = sorted(ctimes, key=operator.itemgetter(1), reverse=False)
    return [filepath for filepath, ctime in  ctimes]

    filepaths = [os.path.join(dir, file)
                 for file in os.listdir(dir)
                 if not file.startswith('.')]
    ctimes = [(path, os.path.getctime(path)) for path in filepaths]
    ctimes = sorted(ctimes, key=operator.itemgetter(1), reverse=False)
    return [filepath for filepath, ctime in  ctimes]

  
  def remove_oldest_files(dir, max_files):
      """
      Remove the oldest files in a directory 'dir', leaving at most 'max_files' remaining.
      We use this to limit the number of resources in the sandbox.
keep keep keep keep replace replace replace keep keep keep keep keep
 reverse takes request as a kwarg for compatibility with django's reverse 
examples/pygments_api/views.py