code: def Import(context, request):
      
      form = request.form
      # TODO form['file'] sometimes returns a list
      infile = form['instrument_results_file'][0] if \
          isinstance(form['instrument_results_file'], list) \
          else form['instrument_results_file']
      override = form['results_override']
      artoapply = form['artoapply']
      instrument = form.get('instrument', None)
      errors = []
      logs = []
  
      # Load the most suitable parser according to file extension/options/etc...
      parser = None
      if not hasattr(infile, 'filename'):
          errors.append(_("No file selected"))
      parser = GCMSQP2010SECSVParser(infile)
  
      if parser:
          # Load the importer
          status = ['sample_received', 'attachment_due', 'to_be_verified']
          if artoapply == 'received':
              status = ['sample_received']
          elif artoapply == 'received_tobeverified':
              status = ['sample_received', 'attachment_due', 'to_be_verified']
  
          over = [False, False]
          if override == 'nooverride':
              over = [False, False]
          elif override == 'override':
              over = [True, False]
          elif override == 'overrideempty':
              over = [True, True]
  
          importer = GCMSQP2010SEImporter(parser=parser,
                                          context=context,
                                          allowed_ar_states=status,
                                          allowed_analysis_states=None,
                                          override=over,
                                          instrument_uid=instrument)
          tbex = ''
          try:
              importer.process()
          except:
              tbex = traceback.format_exc()
          errors = importer.errors
          logs = importer.logs
          warns = importer.warns
          if tbex:
              errors.append(tbex)
  
      results = {'errors': errors, 'log': logs, 'warns': warns}
  
      return json.dumps(results)
docs: Read Shimadzu GCMS-TQ8030 GC/MS/MS analysis results