old_contents: # This file provided by Facebook is for non-commercial testing and evaluation
  # purposes only. Facebook reserves all rights not expressly granted.
  #
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  # FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  
  import json
  import os
  import time
  from flask import Flask, Response, request
  
  app = Flask(__name__, static_url_path='', static_folder='public')
  app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html'))
  
  @app.route('/api/comments', methods=['GET', 'POST'])
  def comments_handler():
  
      with open('comments.json', 'r') as file:
          comments = json.loads(file.read())
  
      if request.method == 'POST':
          newComment = request.form.to_dict()
          newComment['id'] = int(time.time() * 1000)
          comments.append(newComment)
  
          with open('comments.json', 'w') as file:
              file.write(json.dumps(comments, indent=4, separators=(',', ': ')))
  
      return Response(json.dumps(comments), mimetype='application/json', headers={'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*'})
  
  if __name__ == '__main__':
      app.run(port=int(os.environ.get("PORT",3000)))
  
new_contents: # This file provided by Facebook is for non-commercial testing and evaluation
  # purposes only. Facebook reserves all rights not expressly granted.
  #
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  # FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  
  import json
  import os
  import time
  from flask import Flask, Response, request
  
  app = Flask(__name__, static_url_path='', static_folder='public')
  app.add_url_rule('/', 'root', lambda: app.send_static_file('index.html'))
  
  
  @app.route('/api/comments', methods=['GET', 'POST'])
  def comments_handler():
      with open('comments.json', 'r') as f:
          comments = json.loads(f.read())
  
      if request.method == 'POST':
          new_comment = request.form.to_dict()
          new_comment['id'] = int(time.time() * 1000)
          comments.append(new_comment)
  
          with open('comments.json', 'w') as f:
              f.write(json.dumps(comments, indent=4, separators=(',', ': ')))
  
      return Response(
          json.dumps(comments),
          mimetype='application/json',
          headers={
              'Cache-Control': 'no-cache',
              'Access-Control-Allow-Origin': '*'
          }
      )
  
  
  if __name__ == '__main__':
      app.run(port=int(os.environ.get("PORT", 3000)))
  
subject: Remove shadowing of file builtin in server.py. PEP8 formatting